# opagentopology

Provides a simple sample of how to generate the topology XML file used for topology verification. Customers who wish to integrate topology XML file generation into their cluster design process can create their own script to take information available in other formats and tools and produce the topology XML file directly. The alternative is to use `opaxlattopology` and have tools generate the input files it expects.

This tool uses CSV input files opatopology_links.txt, opatopology_FIs.txt, and opatopology_SWs.txt to generate LinkSummary, Node FIs, and Node SWs information, respectively. These files are samples of what might be produced as part of translating a user custom file format into temporary intermediate CSV files.

LinkSummary information includes Link, Cable, and Port information. Note that `opagentopology` (not `opaxmlgenerate`) generates the XML version string as well as the `<Topology>` and `<LinkSummary>` lines. Also note that the indent level is at the default value of zero (0). The portions of the script that call `opaxmlgenerate` follow:

    opaxmlgenerate -X /usr/share/opa/samples/opatopology_1.txt -d \;-h Link
    -g Rate -g Rate_Int -g MTU -g LinkDetails -h Cable -g CableLength -g CableLabel
    -g CableDetails -e Cable -h Port -g NodeGUID -g PortNum -g NodeDesc -g PortGUID
    -g NodeType -g NodeType_Int -g PortDetails -e Port -h Port -g NodeGUID -g PortNum
    -g NodeDesc -g PortGUID -g NodeType -g NodeType_Int -g PortDetails -e Port -e Link

    opaxmlgenerate -X /usr/share/opa/samples/opatopology_2.txt -d \;
    -h Node -g NodeGUID -g NodeDesc -g NodeDetails -g HostName -g NodeType
    -g NodeType_Int -g NumPorts -e Node

## Syntax

    /usr/share/opa/samples/opagentopology [--help]

Note: You must use the full path to access this command.

## Options

No option
  Produces sample output. See Example.
--help
  Produces full help text.

## opatopology_links.txt

This file can be found in /usr/share/opa/samples/. For brevity, this sample shows only two links. The second link shows an example of omitting some information. In the second line, the MTU, LinkDetails, and other fields are not present, which is indicated by an empty value for the field (no entry between the semicolon delimiters).

Note: The following example exceeds the available width of the page. For readability, a blank line is shown between lines to make it clear where the line ends. In an actual link file, no blank lines are used.

    25g;2048;0;IO Server Link;11m;S4567;cable model 456;0x0002c9020020e004;1;bender HFI-1;0x0002c9020020e004;FI;Some info about port;0x0011750007000df6;7;Switch 1234 Leaf 4;;SW;

    25g;;0;;;;;0x0002c9020025a678;1;mindy2 HFI-1;;FI;;0x0011750007000e6d;4;Switch 2345 Leaf 5;;SW;

## opatopology_FIs.txt

This file can be found in /usr/share/opa/samples/. For brevity, this sample shows only two nodes.

    0x0002c9020020e004;bender HFI-1;More details about node
    0x0002c9020025a678;mindy2 HFI-1;Node details

## opatopology_SWs.txt

This file can be found in /usr/share/opa/samples/. For brevity, this sample shows only two nodes.

    0x0011750007000df6;Switch 1234 Leaf 4;
    0x0011750007000e6d;Switch 2345 Leaf 5;

## opatopology_SMs.txt

This file can be found in /usr/share/opa/samples/. For brevity, this sample shows only one node.

    0x0002c9020025a678;1;mindy2 HFI-1;0x0011750007000e6d;FI;details about SM

## Example

When run against the supplied topology input files, /usr/share/opa/samples/opagentopology produces:

    <?xml version="1.0" encoding="utf-8" ?>
    <Topology>
    <LinkSummary>
    <Link>
    <Rate>25g</Rate>
    <MTU>2048</MTU>
    <Internal>0</Internal>
    <LinkDetails>IO Server Link</LinkDetails>
    <Cable>
    <CableLength>11m</CableLength>
    <CableLabel>S4567</CableLabel>
    <CableDetails>cable model 456</CableDetails>
    </Cable>
    <Port>
    <NodeGUID>0x0002c9020020e004</NodeGUID>
    <PortNum>1</PortNum>
    <NodeDesc>bender HFI-1</NodeDesc>
    <PortGUID>0x0002c9020020e004</PortGUID>
    <NodeType>FI</NodeType>
    <PortDetails>Some info about port</PortDetails>
    </Port>
    <Port>
    <NodeGUID>0x0011750007000df6</NodeGUID>
    <PortNum>7</PortNum>
    <NodeDesc>Switch 1234 Leaf 4</NodeDesc>
    <NodeType>SW</NodeType>
    </Port>
    </Link>
    <Link>
    <Rate>25g</Rate>
    <Internal>0</Internal>
    <Cable>
    </Cable>
    <Port>
    <NodeGUID>0x0002c9020025a678</NodeGUID>
    <PortNum>1</PortNum>
    <NodeDesc>mindy2 HFI-1</NodeDesc>
    <NodeType>FI</NodeType>
    </Port>
    <Port>
    <NodeGUID>0x0011750007000e6d</NodeGUID>
    <PortNum>4</PortNum>
    <NodeDesc>Switch 2345 Leaf 5</NodeDesc>
    <NodeType>SW</NodeType>
    </Port>
    </Link>
    </LinkSummary>
    <Nodes>
    <FIs>
    <Node>
    <NodeGUID>0x0002c9020020e004</NodeGUID>
    <NodeDesc>bender HFI-1</NodeDesc>
    <NodeDetails>More details about node</NodeDetails>
    </Node>
    <Node>
    <NodeGUID>0x0002c9020025a678</NodeGUID>
    <NodeDesc>mindy2 HFI-1</NodeDesc>
    <NodeDetails>Node details</NodeDetails>
    </Node>
    </FIs>
    <Switches>
    <Node>
    <NodeGUID>0x0011750007000df6</NodeGUID>
    <NodeDesc>Switch 1234 Leaf 4</NodeDesc>
    </Node>
    <Node>
    <NodeGUID>0x0011750007000e6d</NodeGUID>
    <NodeDesc>Switch 2345 Leaf 5</NodeDesc>
    </Node>
    </Switches>
    <SMs>
    <SM>
    <NodeGUID>0x0002c9020025a678</NodeGUID>
    <PortNum>1</PortNum>
    <NodeDesc>mindy2 HFI-1</NodeDesc>
    <PortGUID>0x0011750007000e6d</PortGUID>
    <NodeType>FI</NodeType>
    <SMDetails>details about SM</SMDetails>
    </SM>
    </SMs>
    </Nodes>
    </Topology>