BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 1 of 10
Number Date Area
Elaborate Derney Ortiz 23/10/2024 Senior DC Planing Enginner
Revised Jesús Parra 03/12/2024 Data Center Proyect Manager
Modification Log
Critical Emitter Description
Approved
No. Fecha Name/Area Modification
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
1
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 2 of 10
Index
[Link] ...................................................................................................................................................... 3
2. Description sent API data ......................................................................................................................... 3
2. Connectivity Topology sending data via API .......................................................................................... 4
3. Access ......................................................................................................................................................... 4
4. Ejemplo de código en Python para llamadas a API ............................................................................... 5
[Link] DCIM Application User Manual (VDC_VM_VPM_V6.9.0_Resful API) ....................................... 10
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
2
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 3 of 10
1. Objective
This document describes the protocol that Cirion is going to implement in order to send data using REST API,
connecting VCOM DCIM Cirion application to Microsoft BMS, providing rich access to the data within the
system to other management systems through web-based communications. The data contained in the app is
available for recovery and can also be created, updated, or deleted where appropriate. Successful
authentication is required to access any data in the system.
2. Description sent API data
Data transfer via Representational State API (REST) provides a powerful, easy-to-use, and standard
mechanism by which different systems can communicate with each other by sending and receiving data.
This mechanism is a web service that is formalized in an Application Programming Interface (API) that
defines which services are provided by the server.
A RESTful application contains resources that are accessed through endpoints using HTTP methods. REST
is resource-based, which are logical representations of documents, data, clients, parts, or just about
anything else. Resources make up the "object model" exposed by the system. VDC contains Resources
that represent devices, racks, alarms, and a number of other items of interest in the system.
A resource has a resource representation that is used to transfer information about it between a client
and the server. In practice, the term "resource" is often used to refer to the resource itself or its
representation in transit, as the precise distinction is often not important. When the distinction is
relevant, the term is usually used more precisely or made clear by the context. Two common
representations in RESTful applications are JSON and XML, which simply define how data is formatted in
transit.
The client and server negotiate the format of the data using the HTTP Content-Type header to indicate
which format is being sent, and accept to indicate which format(s) can be accepted.
Each of the REST resources has a unique endpoint, which is a URL that identifies where that resource can
be found. REST endpoints are accessed using standard HTTP methods.
1. GET is used to retrieve a resource (or a collection of resources) from the server
2. POST is used to create a new resource on the server.
3. PUT is used to update an existing resource on the server with the rendering of that resource from the
client
4. DELETE is used to delete a resource from the server
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
3
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 4 of 10
2. Connectivity Topology sending data via API
3. Access
Before data can be accessed using the REST API, the external system or client must log in to Basic
Authentication. Successful sign-in requires an HTTP POST of credentials on the authentication endpoint
with a valid username and password (application username and password). Once authentication is
successful, a token will be returned to the client that must be provided with subsequent requests. The
user must include the username and password for the application in the request header.
Permissions for IP segments used by the customer are enabled for access
[Link]
[Link]
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
4
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 5 of 10
Data for sending API data from DCIM
user:
password:
URL: [Link]
4. Ejemplo de código en Python para llamadas a API
Below is an example in which parameters can be displayed via API through the software. A similar
display will be presented by each device configured within the app.
# Este script interactúa con la API de VCOM para encontrar y recuperar información sobre racks y servidores.
# Incluye funcionalidades para encontrar racks y servidores por sus IDs (asset_tag propiedad), obtener información
detallada sobre los dispositivos,
# y enumera el contenido de un bastidor. El script también incluye un caso de prueba para demostrar estas
funcionalidades.
Importar sistema operativo
Importar sistema
Hora de importación, fecha y hora
Rastreo de importación
de la importación de subprocesos Bloqueo, subproceso, Evento current_thread
from datetime import datetime
Importar JSON
Importar JSONSCHEMA
de dotenv import load_dotenv, find_dotenv
Importar Redis
Solicitudes de importación
Desde la importación de JSONSCHEMA validate
de escribir importar Dict, Lista
Importar YAML
Importar pathlib
Registro de importación
Registro de importació[Link]
import argparse
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
5
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 6 of 10
Importar CSV
__version__ = "1.0.0"
__version__message__ = "Demostración de la API de VCOM"
[Link].urllib3.disable_warnings()
DEFAULT_LOG_CONFIG = {
"versión": 1,
"formateadores": {
"standard": {"format": "%(asctime)s %(levelname)8s %(name)s: [%(funcname)s] %(message)s"}
},
"manejadores": {
"console": {"class": "Registrando. StreamHandler", "formateador": "estándar"}
},
"root": {"handlers": ["console"], "level": "DEBUG"},
}
log = [Link]()
def load_config(file_name):
file_name = [Link](file_name)
con open(file_name) como fobj:
Devuelve [Link](fobj, Loader=[Link])
def prepare_log(log_config_file=Ninguno):
cfg = DEFAULT_LOG_CONFIG
Si log_config_file:
cfg = load_config(log_config_file)
cfg = [Link]("registro")
Si CFG:
[Link]("versión", 1)
[Link]("disable_existing_loggers", Falso)
[Link](cfg)
Registro de retorno
def eprint(*args, **kwargs):
print(*args, file=[Link], **kwargs)
Servidor de clase:
def __init__(self, uuid, atag, upos, name, modelid, usize):
yo [Link] = uuid
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
6
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 7 of 10
yo [Link] = atag
yo [Link] = upos
yo [Link] = nombre
yo [Link] = ModelID
Son ellos [Link] = usizar
def __str__(self):
return f'uuid[{[Link]}] atag[{[Link]}] upos[{[Link]}] nombre[{[Link]}] modelid[{[Link]}]
usize[{[Link]}]'
clase VCOM:
def __init__(auto):
super().__init__()
yo mismo.vcom_url = sistema [Link]("VCOM_URL", "[Link]
yo mismo.vcom_usr = sistema [Link]("VCOM_USERNAME", "RIO33")
yo mismo.vcom_pwd = [Link]("VCOM_PASSWORD", "Riodejaneiro33")
yo [Link] = {'Content-Type': 'application/json'}
yo [Link]ón = [Link]ón()
yo [Link]ó[Link] = (self.vcom_usr, yo.vcom_pwd)
yo [Link]ó[Link] = Falso
def findRack(self, module_id):
Intención:
[Link](f'[{module_id}]')
rack_uuid = Ninguno
post = f"{self.vcom_url}/resto/dispositivos/lista"
cuerpo = f'{{"filtros": [ {{"vname": "0aeddd86-ce3c-11dd-8da6-001d091dd9dd", "valor": "{module_id}","acción": 2 }}
]}}'
r = sí [Link]ó[Link] (post, data=body, headers=[Link])
Si R.status_code == solicitudes.có[Link]:
obj = [Link]()
if obj["código"] == "1":
datos = obj["datos"]
if data["count"] == 1:
Para rack en datos["lista"]:
rack_uuid = rack["uuid"]
[Link](f'DEBUG: Bastidor encontrado[{rack_uuid}] para module_id[{module_id}]')
De lo contrario:
[Link](f"ERROR: post[{post}] count[{data['count']}]")
De lo contrario:
[Link](f"ERROR: post[{post}] código[{obj['código']}]")
De lo contrario:
[Link](f"ERROR: post[{post}] response_code[{r.status_code}]")
[Link](f'[{module_id}]->[{rack_uuid}]')
Devolver rack_uuid
excepto:
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
7
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 8 of 10
rastreo.print_exc()
return None
def findServer(self, asset_tag):
Intención:
[Link](f'[{asset_tag}]')
server_uuid = Ninguno
post = f"{self.vcom_url}/resto/dispositivos/lista"
body = f'{{"filtros": [ {{"vname": "0aeddd86-ce3c-11dd-8da6-001d091dd9dd", "value": "{asset_tag}","action": 2 }} ]}}'
r = sí [Link]ó[Link] (post, data=body, headers=[Link])
Si R.status_code == solicitudes.có[Link]:
obj = [Link]()
if obj["código"] == "1":
datos = obj["datos"]
if data["count"] == 1:
Para el servidor en data["list"]:
server_uuid = servidor["uuid"]
[Link](f'Servidor encontrado[{server_uuid}] para asset_tag[{asset_tag}]')
De lo contrario:
[Link](f"ERROR: post[{post}] count[{data['count']}]")
De lo contrario:
[Link](f"ERROR: post[{post}] código[{obj['código']}]")
De lo contrario:
[Link](f"ERROR: post[{post}] response_code[{r.status_code}]")
[Link](f'[{asset_tag}]->[{server_uuid}]')
Devolver server_uuid
excepto:
rastreo.print_exc()
return None
def getDeviceInfo(self, server: Server) -> Server:
Intención:
[Link](f'[{[Link]}]')
post = f"{self.vcom_url}/rest/devices/{[Link]}"
body = '{"pd_ids": ["usize"]}'
r = sí [Link]ó[Link] (post, data=body, headers=[Link])
Si R.status_code == solicitudes.có[Link]:
obj = [Link]()
if obj["código"] == "1":
s = obj["datos"]
[Link] = s['usize']
[Link] (f"Servidor encontrado[{s['nombre']}][{s['id']}][{s['usize']}]")
De lo contrario:
[Link](f"ERROR: post[{post}] código[{obj['código']}]")
De lo contrario:
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
8
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 9 of 10
[Link](f"ERROR: post[{post}] response_code[{r.status_code}]")
[Link](f'[{[Link]}] -> [{[Link]}]')
Servidor de devolución
excepto:
rastreo.print_exc()
return None
def getRackContents(self, rack_uuid) -> List[Servidor]:
Intente:
[Link](f'[{rack_uuid}]')
ret = []
get = f"{self.vcom_url}/rest/devices/rdinfo/{rack_uuid}"
r = sí [Link]ó[Link] (get, headers=[Link])
Si R.status_code == solicitudes.có[Link]:
obj = [Link]()
if obj["código"] == "1":
Para el servidor en obj["data"]:
s = [Link](Servidor(servidor["id"], servidor["arroba"], servidor["upos"], servidor["nombre"],
servidor["mid"], Ninguno))
Si [Link] no es ninguno:
[Link] (f"Servidor encontrado[{[Link]}][{[Link]}][{[Link]}][{[Link]}][{[Link]}]")
[Link](s)
De lo contrario:
[Link] (f"Ignorando el dispositivo[{[Link]}][{[Link]}][{[Link]}][{[Link]}][{[Link]}]")
De lo contrario:
[Link](f"ERROR: get[{get}] código[{obj['código']}]")
De lo contrario:
[Link](f"ERROR: get[{get}] response_code[{r.status_code}]")
[Link](f'[{rack_uuid}]->[{len(ret)}]')
return ret
excepto:
rastreo.print_exc()
return None
def testcase(self, rack_id, server_id):
# Encuentra el RACK en VCOM
rack_uuid = [Link](rack_id)
si rack_uuid no es Ninguno:
# Obtener el contenido del RACK en VCOM
servidores = [Link](rack_uuid)
server_uuid = [Link](etiqueta["id"])
si server_uuid no es Ninguno:
servidor = [Link](Servidor(server_uuid, Ninguno, Ninguno, Ninguno, Ninguno, Ninguno,
Ninguno))
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
9
BMS-DCIM – Main changes DCIM- Changes
Date Reviewed Revision # Date of issue Página
DCIM Documentation
09/04/2024 1 10 of 10
Para servidor en servidores:
if [Link] == server_id:
[Link] (f'Found server[{str(server)}] tag[{server_id}] at rack[{rack_id}] upos[{[Link]}]')
Quebrar
def ejecutar():
[Link] ("ejecutar")
load_dotenv(find_dotenv())
vcom = VCOM()
[Link]("RACK1", "SERVER1")
log = prepare_log('./[Link]')
[Link](f"Iniciando. Versión [{__version__}]")
[Link](f"[{__version__message__}]")
ejecutar()
[Link] DCIM Application User Manual (VDC_VM_VPM_V6.9.0_Resful API)
Attached is the user manual document VDC_VVM V6.9.0 REST, which shows the detailed configuration for
sending data via REST API
Cirion puede cambiar, cancelar o sustituir productos y servicios, o variarlos por área de servicio a su exclusivo criterio sin previo aviso.
©2022 Cirion Technologies. Todos los Derechos Reservados.
PG.
10