skip to main content
Programmers documentation > Business objects and data sources > Links > Links
 
Links
Link class
Links are used to display the transmission elements making up the network lines. They feature the same dynamic display as network elements.
Links are predefined business objects of the class IltLink used to represent connections between network resources.
The IltLink class defines the following attributes:
*Media —Indicates the physical medium connecting two network elements ( fiber, for example).
*Name: media
*Value class: IltLink.Media
*Attribute: IltLink.MediaAttribute
*Technology —Indicates the networking technology represented by the link (circuit switching, for example).
*Name: technology
*Value class: IltLink.LinkTechnology
*Attribute: IltLink.TechnologyAttribute
The link technology is very similar to the link media. While the media represents the physical connection (fiber, electrical, for example), the technology represents the various networking technologies that a link can carry. For example, you may have two fiber links, one of them being used for voice and the other one for data.
You can retrieve the class IltLink using its GetIlpClass method. You can handle its instances as simple IlpObject instances and set and get its attributes with the generic methods getAttributeValue and setAttributeValue.
Loading a link defined in XML
This section shows how to load a link from an XML file in a data source. For detailed information about data sources, see Data sources.
All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below:
 
dataSource = new IltDefaultDataSource();
dataSource.parse("LinkXMLFile.xml");
How to define a link in XML
The following is an example of a link defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
 
<cpldata>
  <addObject id="NE1">
    <class>ilog.tgo.model.IltNetworkElement</class>
      <attribute name="name">NE1</attribute>
      <attribute name="family">OC12</attribute>
      <attribute name="type">MD</attribute>
      <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
        <x>200</x> <y>200</y>
      </attribute>
  </addObject>
  <addObject id="NE2">
    <class>ilog.tgo.model.IltNetworkElement</class>
      <attribute name="name">NE2</attribute>
      <attribute name="type">MD</attribute>
      <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
        <x>400</x> <y>200</y>
      </attribute>
  </addObject>
  <addObject id="NE1-NE2">
    <class>ilog.tgo.model.IltLink</class>
      <link> <from>NE1</from> <to>NE2</to> </link>
        <attribute name="name">Link1</attribute>
        <attribute name="media">Fiber</attribute>
        <attribute name="objectState"
                          javaClass="ilog.tgo.model.IltSONETObjectState">
          <state>ActiveProtecting</state>
          <protection>Exercisor</protection>
        </attribute>
  </addObject>
</cplData>
The following figure shows the link displayed in a network component:
Link displayed in a network component
Creating a link with the API
This section shows how to create a link through the API and how to add it to a data source.
How to create a link with the API
 
IltNetworkElement ne1 = new IltNetworkElement("NE1",
                                               IltNetworkElement.Type.MD,
                                               new IltOSIObjectState());
ne1.setAttributeValue(IltObject.PositionAttribute,
                      new IlpPoint(200, 200));
IltNetworkElement ne2 = new IltNetworkElement("NE2",
                                               IltNetworkElement.Type.MD,
                                               new IltOSIObjectState());
ne2.setAttributeValue(IltObject.PositionAttribute,
                      new IlpPoint(400, 200));
IltSONETObjectState linkState = new
             IltSONETObjectState(IltSONET.State.ActiveProtecting);
linkState.addProtection(IltSONET.End.From, IltSONET.Protection.Exercisor);
linkState.addProtection(IltSONET.End.To, IltSONET.Protection.Exercisor);
IltLink link = new IltLink (linkState, "Link1", IltLink.Media.Fiber);
 
IltDefaultDataSource dataSource = new IltDefaultDataSource();
dataSource.setLink(link.getIdentifier(), ne1.getIdentifier(),
             ne2.getIdentifier());
List objs = new ArrayList();
objs.add(ne1);
objs.add(ne2);
objs.add(link);
dataSource.addObjects(objs);
The result looks like this:
Link displayed in a network component

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.