I am trying to figure out how to import related items from OCS Inventory. I have my devices being imported successfully, but when I try and import monitors and tie them to their related devices the monitors end up being imported as PCs and no relationship is created (additionally until I made the Code unique in the class, I was ending up with three copies of each monitor every time I ran the connector.sh script). I think I did everything in the docs, the one thing I don't understand is the statement "In the case of master class-related cards, as in the case of Monitor, the previous tag pair, with their attributes, must always be specified."
Given the cmbuild-schema.xml and transform.xml below, can anyone tell me what I'm missing? I created a PcMonitor domain that maps 1:N from PC to Monitor, I assumed that would handle the relationship mapping for me.
cmbuild-schema.xml:
<?xml version="1.0"?>
<CMDBUILD>
<PC>
<Code />
<Description />
<SerialNumber />
<Brand />
<Model />
<RAM />
<IPAddress />
<CPUNumber />
<CPUSpeed />
</PC>
<Monitor>
<Code />
<Description />
<SerialNumber />
<Brand />
<Model />
</Monitor>
</CMDBUILD>
transform.xml:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" />
<xsl:template match="/">
<CMDBUILD>
<xsl:apply-templates />
</CMDBUILD>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="text()"></xsl:template>
<xsl:template match="/inventory/device">
<PC key="Code">
<Code>
<xsl:value-of select="./UUID" />
</Code>
<Description>
<xsl:value-of select="./NAME" />
</Description>
<Brand>
<xsl:value-of select="./SMANUFACTURER" />
</Brand>
<Model>
<xsl:value-of select="./SMODEL" />
</Model>
<SerialNumber>
<xsl:value-of select="./SSN" />
</SerialNumber>
<IPAddress>
<xsl:value-of select="./IPADDR" />
</IPAddress>
<RAM>
<xsl:value-of select="sum(/inventory/memory/CAPACITY)" />
</RAM>
<CPUNumber>
<xsl:value-of select="./PROCESSORN" />
</CPUNumber>
<CPUSpeed>
<xsl:value-of select="./PROCESSORS" />
</CPUSpeed>
</PC>
</xsl:template>
<xsl:template match="/inventory/monitor">
<Monitor key="Code">
<Code>
<xsl:value-of select="./ID" />
</Code>
<Description>
<xsl:value-of select="./DESCRIPTION" />
</Description>
<SerialNumber>
<xsl:value-of select="./SERIAL" />
</SerialNumber>
<Brand>
<xsl:value-of select="./MANUFACTURER" />
</Brand>
<Model>
<xsl:value-of select="./CAPTION" />
</Model>
</Monitor>
</xsl:template>
<xsl:template match="/CMDBUILD/PC">
<PC key="Code">
<xsl:attribute name="objid">
<xsl:value-of select="./@objid" />
</xsl:attribute>
<Code>
<xsl:value-of select="./Code" />
</Code>
<Description>
<xsl:value-of select="./Description" />
</Description>
<Brand>
<xsl:value-of select="./Brand" />
</Brand>
<Model>
<xsl:value-of select="./Model" />
</Model>
<SerialNumber>
<xsl:value-of select="./SerialNumber" />
</SerialNumber>
<IPAddress>
<xsl:value-of select="./SerialNumber" />
</IPAddress>
<RAM>
<xsl:value-of select="./RAM" />
</RAM>
<CPUNumber>
<xsl:value-of select="./CPUNumber" />
</CPUNumber>
<CPUSpeed>
<xsl:value-of select="./CPUSpeed" />
</CPUSpeed>
</PC>
</xsl:template>
<xsl:template match="/CMDBUILD/Monitor">
<Monitor domain="PcMonitor" domaindirection="directed" identifiers="Code">
<xsl:attribute name="objid">
<xsl:value-of select="./@objid" />
</xsl:attribute>
<Code>
<xsl:value-of select="./Code" />
</Code>
<Description>
<xsl:value-of select="./Description" />
</Description>
<SerialNumber>
<xsl:value-of select="./SerialNumber" />
</SerialNumber>
<Brand>
<xsl:value-of select="./Brand" />
</Brand>
<Model>
<xsl:value-of select="./Model" />
</Model>
</Monitor>
</xsl:template>
</xsl:stylesheet>