Converter.source.classes namespace

Converter.source.classes.BaseConverter module

class Converter.source.classes.BaseConverter.BaseConverter(url: str, headersGET: dict[str, Any], headersPOST: dict[str, Any], **kw)

Bases: object

Base class for all converters

GetFile(endpoint: str, headers: dict[str, Any] | None = None) bytes

send a GET request to the API for a file

Parameters:
  • endpoint (str) – the API’s endpoint

  • headers (dict[str,Any]|None) – optionnal headers if you want to override the GET headers set when creating the Converter instance

Returns:

a bytes containing the API’s response

Return type:

bytes

GetJSON(endpoint: str, headers: dict[str, Any] | None = None) dict[str, Any]

send a GET request to the API

Parameters:
  • endpoint (str) – the API’s endpoint

  • headers (dict[str,Any]|None) – optionnal headers if you want to override the GET headers set when creating the Converter instance

Returns:

a json containing the API’s response

Return type:

dict[str,Any]

PostData()

Not implemented yet

PostFile(endpoint: str, payload: dict[str, Any], headers: dict[str, Any] | None = None) bytes

send a POST request to the API for a file

Parameters:
  • endpoint (str) – the API’s endpoint

  • payload (dict[str,Any]) – a JSON containing the payload of the POST request

  • headers (dict[str,Any]|None) – optionnal headers if you want to override the POST headers set when creating the Converter instance

Returns:

a bytes containing the API’s response

Return type:

bytes

PostJSON(endpoint: str, payload: dict[str, Any], headers: dict[str, Any] | None = None) dict[str, Any]

send a POST request to the API

Parameters:
  • endpoint (str) – the API’s endpoint

  • payload (dict[str,Any]) – a JSON containing the payload of the POST request

  • headers (dict[str,Any]|None) – optionnal headers if you want to override the POST headers set when creating the Converter instance

Returns:

a json containing the API’s response

Return type:

dict[str,Any]

PutData()

Not implemented yet

SaveToFile()

Not implemented yet

Converter.source.classes.NetBoxToOGrEE module

Converter.source.classes.NetBoxTodcTrack module

Converter.source.classes.OGrEEToNetBox module

Converter.source.classes.OGrEETodcTrack module

Converter.source.classes.dcTrackToNetBox module

Converter.source.classes.dcTrackToOGrEE module

class Converter.source.classes.dcTrackToOGrEE.dcTrackToOGrEE(url: str, headersGET: dict[str, Any], headersPOST: dict[str, Any], outputPath: str | None = None, **kw)

Bases: IToOGrEE, BaseConverter

Convert data from dcTrack to OGrEE

Parameters:
  • IToOGrEE (ItoOGrEE) – Interface of to-OGrEE converters

  • BaseConverter (BaseConverter) – Base class of all converters

BuildBuilding(data: dict[str, Any]) dict[str, Any]

Build a building from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “name” - can contains “description”, “parentId”, “domain”, “attributes” and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE building

Return type:

dict[str, Any]

BuildDevice(data: dict[str, Any]) dict[str, Any]

Build a device from dcTdevice data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “tiName”, “tiMounting”, “cmbUPosition” (if “tiMounting“‘s value is “Rackable”), “radioCabinetSide” and “radioDepthPosition” (if “tiMounting“‘s value is “ZeroU”) and “sizeWDHmm” - can contains “description”, “parentId”, “domain”, “attributes”,”template”, and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE rack

Return type:

dict[str, Any]

BuildDomain(data: dict[str, Any]) dict[str, Any]

Build a domain from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “name” - can contains “description”, “id”, “attributes” and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE domain

Return type:

dict[str, Any]

BuildRack(data: dict[str, Any]) dict[str, Any]

Build a rack from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “tiName” and “sizeWDHmm” - can contains “description”, “parentId”, “domain”, “attributes”,”template” and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE rack

Return type:

dict[str, Any]

BuildRoom(data: dict[str, Any]) dict[str, Any]

Build a room from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “name” - can contains “description”, “parentId”, “domain”, “attributes” and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE room

Return type:

dict[str, Any]

BuildSite(data: dict[str, Any]) dict[str, Any]

Build a site from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “name” - can contains “description”, “parentId”, “domain”, “attributes” and “children” keys - all other keys will be ignored

Returns:

a dict describing an OGrEE site

Return type:

dict[str, Any]

BuildTemplate(data: dict[str, Any]) dict[str, Any]

Build a template from dcTrack data

Parameters:

data (dict[str, Any]) – dcTrack data, - must contains “model”, “dimHeight”, “dimDepth”, “dimWidth”, “make”, “category”, “class”, “powerPorts”, “dataPorsts”, “ruHeight” (if “category“‘s value is “rack”) - all other keys will be ignored

Returns:

a dict describing an OGrEE template

Return type:

dict[str, Any]