What is the correct formatting for XML files when importing using the Spectrum Modeling Gateway
Release: Any
Component: SPCDIS
In the examples below the desired result is to a have a container created, a sub-container within this, a further sub-container created within this, into which devices are to be created.
First is an example where you can see incorrect formatting used in the modeling gateway XML file and as a result 3 devices are not placed in the topology in the correct location. Only the first container in the XML file is created (topology or location container). The other devices are created on the top topology view.
After this you will see an example with the correct formatting resulting in the creation of the containers in the desired location and 2 devices within them.
Finally there is an explanation of why the first example is incorrect, and the changes made in the second example so that the containers, sub-containers and devices are created correctly.
Example 1 - Incorrect syntax
<?xml version="1.0" standalone="no"?> <!DOCTYPE Import SYSTEM ".modelinggateway.dtd"> <Import> <!-- Topology view --> <Topology complete_topology="false"> <Topology_Container model_type="Network" name="EMEA"> <Topology_Container model_type="Network" name="UNITED-KINGDOM"> <Topology_Container model_type="Network" name="LONDON"> <Device ip_dnsname="xxx.xxx.xxx.xxx" model_name="<DEVICE1>" discover_connections="true" community_string="xxxxx"/> </Topology_Container> </Topology_Container> </Topology_Container> <Topology_Container model_type="Network" name="EMEA"> <Topology_Container model_type="Network" name="UNITED-KINGDOM"> <Topology_Container model_type="Network" name="LIVERPOOL"> <Device ip_dnsname="xxx.xxx.xxx.xxx" model_name="<DEVICE2>" discover_connections="true" community_string="xxxxx"/> </Topology_Container> </Topology_Container> </Topology_Container> <Topology_Container model_type="Network" name="EMEA"> <Topology_Container model_type="Network" name="UNITED-KINGDOM"> <Topology_Container model_type="Network" name="MANCHESTER"> <Device ip_dnsname="xxx.xxx.xxx.xxx" model_name="<DEVICE3>" discover_connections="true" community_string="xxxxx"/> </Topology_Container> </Topology_Container> </Topology_Container> </Topology> </Import>
Example 2- Correct Syntax:
<Import> <!-- Topology view --> <Topology complete_topology="false"> <Topology_Container model_type="Network" name="EMEA"> <Topology_Container model_type="Network" name="UNITED-KINGDOM"> <Topology_Container model_type="Network" name="LONDON"> <Device ip_dnsname="xxx.xxx.xxx.xxx" model_name="<DEVICE1>" community_string="public"/> </Topology_Container> <Topology_Container model_type="Network" name="LIVERPOOL"> <Device ip_dnsname="xxx.xxx.xxx.xxx" model_name="<DEVICE2>" community_string="public"/> </Topology_Container> <Topology_Container model_type="Network" name="MANCHESTER"> <Device ip_dnsname="xxx.xxx.xxx.xxx" community_string="public"/> </Topology_Container> </Topology_Container> </Topology_Container> </Topology> </Import>
Explanation of example 1 and example 2:
See example 2 from the fixed and note there is no repetition of EMEA and UNITED-KINGDOM (highlighted in bold in example 1 where repeated).
Please reference the "Modeling Gateway Toolkit" section of the documentation for more information.