1. Busque en la CMDB de ServiceNow la clase que representa al dispositivo “Desktop” de ADM; para el ejemplo se relacionará “Desktop” con la clase “cmdb_ci_computer” de ServiceNow, esta clase tiene diferentes clases relacionadas (Referenciadas); se tendrán en cuenta para el registro en el archivo.
2. Busque las clases que tiene una referencia con “cmdb_ci_computer”, como los registros Model ID, Manufacturer y Managed By:
3. Escoja y busque el nombre de las clases referenciadas que desea incluir, para el ejemplo se incluyen las siguientes clases:
Clases | Descripción |
---|---|
core_company | Proporciona información de la compañía que creó al dispositivo o a la compañía de la que hace parte. |
sys_user | Proporciona información de la persona o usuario que es responsable del dispositivo. |
cmdb_model | Proporciona información del modelo del dispositivo, para relacionar los dispositivos tipo “Computer” ServiceNow usa la clase “cmdb_hardware_product_model” que hereda de “cmdb_model”, donde se agregarán los modelos de los dispositivos si no existen. |
sys_choice | Su valor se obtiene a través de un “select box” . |
4. En la propiedad “classCMDB” del archivo de configuración, se agregaran las clases que busco anteriormente.
El nombre de las clases escríbalas en la propiedad name, de la siguiente forma:
```json
"classCMDB": [
{
"searchBy": [
],
"name": "cmdb_ci_computer",
"fields": [
]
},
{
"searchBy": [
],
"name": "sys_user",
"fields": [
]
},
{
"searchBy": [
],
"name": "cmdb_hardware_product_model",
"fields": [
]
},
{
"searchBy": [
],
"name": "sys_choice",
"fields": [
]
}
]
```
5. Escoja los atributos de la clase CI “cmdb_ci_computer” que relacionará con los atributos de los dispositivos, como se describe en la sección “Atributos de las clases CI (fields)”.
Los atributos escogidos para la clase “cmdb_ci_computer” son:
os_version
name
short_description
disk_space
dns_domain
ip_address
sys_created_on
disk_space
ram
cpu_count
cpu_core_count
object_id
6. Agregue el nombre y tipo de los atributos en la propiedad “fields”, tenga en cuenta las siguientes propiedades:
```json
{
"type": "",
"name": "",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": ""
}
```
```json
[
{
"type": "string",
"name": "os_version",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "name",
"mappingType": "",
"mappingName": "" ,
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "short_description",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "dns_domain",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "ip_address",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "integer",
"name": "ram",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "integer",
"name": "cpu_count",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "integer",
"name": "cpu_core_count",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
},
{
"type": "string",
"name": "object_id",
"mappingType": "",
"mappingName": "",
"isRequired": ,
"classReference": null
}
]
```
7. En la propiedad “isRequired” escriba “true” o “false” si esta propiedad es requerida o no respectivamente, como se observa a continuación:
```json
[
{
"type": "string",
"name": "os_version",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "name",
"mappingType": "",
"mappingName": "" ,
"isRequired": true,
"classReference": null
},
{
"type": "string",
"name": "short_description",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "dns_domain",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "ip_address",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "ram",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_count",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_core_count",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "object_id",
"mappingType": "",
"mappingName": "",
"isRequired": false,
"classReference": null
}
]
```
8. La propiedad “mappingType” se agrega acorde a la siguiente información:
Tipos de campos
Campos | Descripción |
---|---|
Mapper | Representa al valor obtenido directamente del API de Aranda DEVICE MANAGEMEN ADM, se transforma en el tipo de valor permitido por ServiceNow y se agrega el valor. |
SysChoice | Representa un valor que hace referencia a una entidad donde se agregan datos en listas correspondientes a la clase CI (para el ejemplo la clase cmdb_ci_computer), el nombre de esta clase es “sys_choice” que se incluyo dentro de la propiedad “classCMDB”. |
Reference | El valor ingresado crea una relación entre el CI y la clase CMDB. |
Los campos antes adicionados obtendrán su valor de las APIs de Aranda DEVICE MANAGEMEN ADM, en la propiedad “mappingType” ingrese el valor de “Mapper” como se muestra a continuación :
```json
[
{
"type": "string",
"name": "os_version",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": "" ,
"isRequired": true,
"classReference": null
},
{
"type": "string",
"name": "short_description",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "dns_domain",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "ip_address",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "MB",
"name": "ram",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "GB",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_count",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_core_count",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "object_id",
"mappingType": "Mapper",
"mappingName": "",
"isRequired": false,
"classReference": null
}
]
```
9. a propiedad “mappingName” sirve para formar una relación entre la propiedad “classCMDB” y “mapper” o “dataReference” según corresponda ver mas.
Agregue los siguientes valores que se relacionan con la propiedad “mapper”, cuando se completen mas configuraciones del archivo:
- DeviceComputerReference
- DeviceComputerReferenceNetwork
El valor de DeviceComputerReferenceNetwork se agrega con el fin de hacer una caracterización hacia componentes de red, no influye en el mapeo.
El archivo de configuración con la propiedad de “mappingName” queda configurado de la siguiente forma:
```json
[
{
"type": "string",
"name": "os_version",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference" ,
"isRequired": true,
"classReference": null
},
{
"type": "string",
"name": "short_description",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "dns_domain",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReferenceNetwork",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "ip_address",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReferenceNetwork",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "MB",
"name": "ram",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "GB",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_count",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_core_count",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "object_id",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
}
]
``` <span>10.</span> Registrar los atributos de la clase "cmdb_ci_computer" con referencia; como se explico en el punto **3** la clase "cmdb_ci_computer" tiene las siguientes referencias:
- “core_company” (tipo: Reference).
- “sys_user” (tipo: Reference).
- “cmdb_model” => “cmdb_hardware_product_model” (tipo: Reference).
- “sys_choice” (tipo: SysChoice).
Los atributos que son de tipo “Reference” se registraran en la propiedad “mappingType” con el valor de “Reference”, el cual determina que esta propiedad relaciona a la clase CI con las clases ya listadas.
En la propiedad “classReference” coloque el nombre de la tabla a la que el atributo hace referencia, por ejemplo:
```
Atributo Clase Referenciada
manufacturer core_company
company core_company
model_id cmdb_hardware_product_model
assigned_to sys_user
``` Agregue esta relación con las propiedades listadas en el punto **6**
```json
{
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "model_id",
"mappingType": "Reference",
"mappingName": "",
"isRequired": false,
"classReference": "cmdb_hardware_product_model"
},
{
"type": "string",
"name": "assigned_to",
"mappingType": "Reference",
"mappingName": "",
"isRequired": false,
"classReference": "sys_user"
},
}
```
Los atributos de tipo “SysChoice” se agregan de la siguiente forma:
```json
{
{
"type": "string",
"name": "os",
"mappingType": "SysChoice",
"mappingName": "",
"isRequired": false,
"classReference": "sys_choice"
},
{
"type": "string",
"name": "discovery_source",
"mappingType": "SysChoice",
"mappingName": "",
"isRequired": false,
"classReference": "sys_choice"
}
}
```
11.. Tenga en cuenta que las propiedades de la clase “cmdb_ci_computer” referencia a otras clases que contienen atributos de tipo “Mapper” se usará la propiedad “mappingName” para referir-las a “mapper”; así estas clases usarán la referencia para resolver su valor.
- CompanyManufactureReference
- CompanyOwnerReference
- HardwareProductModelReference
- UserDeviceReference
- OperatingSystemReferenced
- DiscoverySourceReferenced
NO se duplicarán las clases en la propiedad “classCMDB”; mediante el campo de “mappingName” se establece cómo, la clase a la que se hace referencia, obtendrá los valores.
Escriba los anteriores valores en los atributos de la siguiente forma:
```json
{
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "CompanyManufactureReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "CompanyOwnerReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "model_id",
"mappingType": "Reference",
"mappingName": "HardwareProductModelReference",
"isRequired": false,
"classReference": "cmdb_hardware_product_model"
},
{
"type": "string",
"name": "assigned_to",
"mappingType": "Reference",
"mappingName": "UserDeviceReference",
"isRequired": false,
"classReference": "sys_user"
},
}
```
Los atributos de tipo “SysChoice”:
```json
{
{
"type": "string",
"name": "os",
"mappingType": "SysChoice",
"mappingName": "OperatingSystemReferenced",
"isRequired": false,
"classReference": "sys_choice"
},
{
"type": "string",
"name": "discovery_source",
"mappingType": "SysChoice",
"mappingName": "DiscoverySourceReferenced",
"isRequired": false,
"classReference": "sys_choice"
}
}
```
12. Los objetos que agregamos en la propiedad “classCMDB” tienen la propiedad “searchBy”, esta propiedad sirve para buscar al dispositivo o los datos agregados a ServiceNow. Para el ejemplo se contrasta la información entre ADM y ServiceNow usando el id del dispositivo que lo proporciona Aranda DEVICE MANAGEMENT ADM y lo mapea en el atributo “object_id” de la clase “cmdb_ci_computer”; este id es único y servirá para evitar la duplicación de los dispositivos, por esta razón ingrese el atributo “object_id” dentro de la propiedad searchBy del archivo de configuración, como se presenta a continuación.
```json
"classCMDB": [
{
"searchBy": [
"object_id"
],
"name": "cmdb_ci_computer",
"fields": [
]
}
]
```
Como resultado se obtiene el siguiente JSON, con los atributos que se mapearán:
"classCMDB": [
{
"searchBy": [
"object_id"
],
"name": "cmdb_ci_computer",
"fields": [
{
"type": "string",
"name": "os",
"mappingType": "SysChoice",
"mappingName": "OperatingSystemReferenced",
"isRequired": false,
"classReference": "sys_choice"
},
{
"type": "string",
"name": "discovery_source",
"mappingType": "SysChoice",
"mappingName": "DiscoverySourceReferenced",
"isRequired": false,
"classReference": "sys_choice"
},
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "CompanyManufacturerReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "CompanyOwnerReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "model_id",
"mappingType": "Reference",
"mappingName": "HardwareProductModelReference",
"isRequired": false,
"classReference": "cmdb_hardware_product_model"
},
{
"type": "string",
"name": "assigned_to",
"mappingType": "Reference",
"mappingName": "UserDeviceReference",
"isRequired": false,
"classReference": "sys_user"
},
{
"type": "string",
"name": "os_version",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference" ,
"isRequired": true,
"classReference": null
},
{
"type": "string",
"name": "short_description",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "dns_domain",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReferenceNetwork",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "ip_address",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReferenceNetwork",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "sys_created_on",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "MB",
"name": "ram",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"unit": "GB",
"name": "disk_space",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_count",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "integer",
"name": "cpu_core_count",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
},
{
"type": "string",
"name": "object_id",
"mappingType": "Mapper",
"mappingName": "DeviceComputerReference",
"isRequired": false,
"classReference": null
}
]
},
{
"searchBy": [
],
"name": "sys_user",
"fields": [
]
},
{
"searchBy": [
],
"name": "cmdb_hardware_product_model",
"fields": [
]
},
{
"searchBy": [
],
"name": "sys_choice",
"fields": [
]
}
]
Para las clases que no se registran en esta sección colocamos los siguientes enlaces, que puede consultar; el proceso es el mismo que se realizó con la clase cmdb_ci_computer.
Clases ServiceNow
Continuar: Relación entre classCMDB y mapper (paso 3) ↪