Understanding NetDMF

From NetDMF
Jump to: navigation, search

Class attributes

  • Name(string){"vehicule1", "Ipv4Ping"}: Application, Channel, Node, Platform, Protocol, Result, Scenario, Stack


  • AddressType(enum){ETH, IP...}: AddressItem, Conversation
  • ChannelType(enum){"Simplex","Duplex"}:Channel
  • DeviceType(enum){"Mobility", "Communication"}: Device
  • EventType(enum){"Movement", "Communication", "Collection"}:Event
  • CommunicationType(enum){"Conversation", "Application", "PacketCapture"}: Event
    • should be a Conversation property instead
  • MovementType(enum){"Model", "Path"}:Movement
  • PacketType(enum){"Filter", "Range"}:PacketItem
  • LinkType(enum){"DLT_*"}:PacketData
  • ProtocolType(enum){"Physical","Link"...}:Protocol
  • TrafficType(enum){"Bin", "Peak"}: Traffic


  • NodeId(Integer){"0","1"}: Node
  • EndPointAPort(Integer){"80", "33"}: Conversation
  • EndPointBPort(Integer){"80", "33"}: Conversation


  • Parameter(key,string){"Interval":"1.0",...}: Application, Channel, Device, Communication, Event, Movement, Node, Platform, Scenario, Stack

Properties represented by edges

  • EndPointA(string){"255.0.0.1"}: Conversation
  • EndPointB(string){"255.0.0.1"): Conversation
  • TrafficDirection(enum){"AtoB","BtoA"}: Traffic

Time property

  • StartTime(Time):Event, Traffic
  • EndTime(Time):Event, Traffic
  • TimeSeconds(Time):PacketData
  • TimeMicroSeconds(Time):PacketData
  • TrafficInterval(integer){"1.0"): Traffic
  • MovementInterval(string){"1.0"}:Movement(type=Path)

Internal prop (describes the internal structure of value data):

  • AddressFormat(enum){XML,XDNF}: AddressItem
  • PacketFormat(enum){XML, XDMF, PCAP}: PacketItem
  • Units(enum){"Bytes", "KBytes"}: Traffic
  • ModelName(enum){"RandomWalk"...}:Movement(type=Model)
  • ModelData(string){"interval=1.0s maxspeed=0.5m/s"...}:Movement(type=Model)
  • MovementDataComponents(string){???}:Movement(type=Path)
  • PathPositionType(enum){"Grid","Geospatial"...}:Movement(type=Path)
  • Filter(string){"src host 10.11.102.23 and dst host 10.11.104.23"}: PacketItem

Internal prop that is computed from the data

  • TotalAToB(Integer){"47530"}: Conversation
  • TotalBToA(Integer){"47530"}: Conversation
  • NumberOfBins(integer){}:Traffic
  • WireLength(Integer){}: PacketData
  • CapLength(Integer){}: PacketData


Listing per class

  • Application: Name, Parameters
  • Channel: Name, ChannelType, Parameters
  • Conversation: AddressType, EndPointA, EndPointB, EndPointAPort, EndPointBPort, TotalAToB, TotalBToA
  • Device: Name, DeviceType, Parameters
  • Event: EventType, CommunicationType, StartTime, EndTime, Parameters
  • Movement: MovementType, ModelName, ModelData, MovementDataComponents, MovementInterval, PathPositionType, Parameters
  • Node: Name, NodeId, Parameters
  • PacketData: LinkType, WireLength, CapLength, TimeSeconds, TimeMicroSeconds
  • PacketItem: PacketType, Filter, PacketFormat
  • Platform: Name, Parameter
  • Protocol: ProtocolType, Name
  • Result: Name
  • Scenario: Name, Parameters
  • Stack: Name, Parameters
  • Traffic: TrafficType, Units, Interval, NumberOfBins

Example1.xmn (corrected) + Example2.xmn

<?xml version="1.0" ?>

<Xdenf xmlns:xi="http://www.w3.org/2001/XInclude">
<Device Name="Radio1" DeviceType="Channel" DataRate="5000000" Delay="2"/>
<Device Name="Radio2" DeviceType="Channel" DataRate="1000000" Delay="2"/>
<Device Name="SUV" DeviceType="Mobility" Wheels="4" TopSpeed="10.0" />

<Protocol Name="Tcp" ProtocolType="Transport" />
<Protocol Name="Udp" ProtocolType="Transport" />
<Protocol Name="Ipv4" ProtocolType="Network" />
<Protocol Name="Ipv6" ProtocolType="Network" />
<Protocol Name="Ethernet" ProtocolType="Link" />
<Protocol Name="Token Ring" ProtocolType="Link" />
<Protocol Name="Wifi" ProtocolType="Link" />
<Protocol Name="Wimax" ProtocolType="Link" />
<Protocol Name="Ppp" ProtocolType="Link" />
<Protocol Name="FDDI" ProtocolType="Link" />
<Protocol Name="802.11" ProtocolType="Link" />
<Protocol Name="Olsr" ProtocolType="Routing" />

<xi:include href="DefaultCommDevices.xdf" xpointer="xpointer(//Xdenf/Device[@DeviceType='Channel'])" />

<Communication Name="SimpleOlsr" >
   <Stack Reference="/Xdenf/Protocol[@Name='Olsr']" > 
        <Stack Reference="/Xdenf/Protocol[@Name='Udp']" > 
             <Stack Reference="/Xdenf/Protocol[@Name='Ipv4']" > 
                  <Stack Reference="/Xdenf/Protocol[@Name='Ppp']" > 
                       <Channel Reference="/Xdenf/Device[@Name='Radio1']" Delay="1" />
                  </Stack>
              </Stack>
        </Stack>
   </Stack>
</Communication>

<Node Name="Person1"  NodeId="0" Position="0.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
        <Stack Name="Ipv4" Addr="10.1.1.1" />
    </Communication>
</Node>
<Node Name="Person2"  NodeId="1" Position="1.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
        <Stack Name="Ipv4" Addr="10.1.1.2" />
    </Communication>
</Node>
<Node Name="Person3"  NodeId="2" Position="2.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
        <Stack Name="Ipv4" Addr="10.1.1.3" />
    </Communication>
</Node>

<Event Name="Simple OLSR Simulation" StartTime="0.0" Endtime="50.0">
    <Event EventType="Move" StartTime="0.1" EndTime="0.2" NodeId="1" Dest="1.0 1.0 0.0" />
    <Event EventType="Move" StartTime="0.1" EndTime="0.3" NodeId="2" Dest="2.0 2.0 0.0" />
    <Event EventType="Comm" StartTime="0.15" EndTime="1.2">
        <Conversation Type="IPV4" SrcNode="1" DestNode="2">
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
        </Conversation>
        <Conversation Type="IPV4" SrcNode="0" DestNode="2">
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
            <Packet>
                ReferenceToPacketHeavyData XML | MySQL
            </Packet>
        </Conversation>
    </Event>
    <Event EventType="Comm" StartTime="2.0" EndTime="30.0" NodeId="1">
        <Application ApplicationType="HttpServer">
        </Application>
    </Event>
</Event>


<AddressItem
    AddressType="IPV4"
    NumberOfAddresses="3"
    Format="XML"
    >
        10.11.102.23
        10.11.104.23
        192.168.0.1
        192.168.0.12
</AddressItem>

<AddressItem
    AddressType="MAC"
    NumberOfAddresses="3"
    Format="XML"
    >
        00:12:80:6D:6A:2A
        00:13:1A:36:3F:E8
        00:10:D6:00:0C:93
</AddressItem>

<AddressItem
    AddressType="MAC"
    NumberOfAddresses="3"
    Format="XDMF"
    >
     <DataItem 
        NumberType="UChar"
        Dimensions="3 6"
        Format="HDF">
        /data/MacAddresses.h5:/Zone1/Addresses
      </DataItem>
</AddressItem>

<PacketItem
    NumberOfPackets="100"
    PacketType="Range"
    Range="0 109"
    Format="PCAP">
    test.pcap
</PacketItem>

<PacketItem
    NumberOfPackets="100"
    PacketType="Filter"
    Filter="src host 10.11.102.23 and dst host 10.11.104.23"
    Format="PCAP">
    test.pcap
</PacketItem>

</Xdenf>
<?xml version="1.0" ?>

<Xdenf xmlns:xi="http://www.w3.org/2001/XInclude">
<Device Name="Radio1" DeviceType="Channel" DataRate="5000000" Delay="2"/>
<Device Name="Radio2" DeviceType="Channel" DataRate="1000000" Delay="2"/>
<Device Name="SUV" DeviceType="Mobility" Wheels="4" TopSpeed="10.0" />

<Protocol Name="Tcp" ProtocolType="Transport" />
<Protocol Name="Udp" ProtocolType="Transport" />
<Protocol Name="Ipv4" ProtocolType="Network" />
<Protocol Name="Ipv6" ProtocolType="Network" />
<Protocol Name="Ethernet" ProtocolType="Link" />
<Protocol Name="Token Ring" ProtocolType="Link" />
<Protocol Name="Wifi" ProtocolType="Link" />
<Protocol Name="Wimax" ProtocolType="Link" />
<Protocol Name="Ppp" ProtocolType="Link" />
<Protocol Name="FDDI" ProtocolType="Link" />
<Protocol Name="802.11" ProtocolType="Link" />
<Protocol Name="Olsr" ProtocolType="Routing" />

<xi:include href="DefaultCommDevices.xdf" xpointer="xpointer(//Xdenf/Device[@DeviceType='Channel'])" />

<Communication Name="SimpleOlsr" >
   <Stack Reference="/Xdenf/Protocol[@Name='Olsr']" > 
        <Stack Reference="/Xdenf/Protocol[@Name='Udp']" > 
             <Stack Reference="/Xdenf/Protocol[@Name='Ipv4']" > 
                  <Stack Reference="/Xdenf/Protocol[@Name='Ppp']" > 
                       <Channel Reference="/Xdenf/Device[@Name='Radio1']" Delay="1" />
                  </Stack>
              </Stack>
        </Stack>
   </Stack>
</Communication>

<AddressItem
    AddressType="IPV4"
    NumberOfAddresses="3"
    Format="XML"
    >
        10.11.102.23
        10.11.104.23
        192.168.0.1
        192.168.0.12
</AddressItem>

<AddressItem
    AddressType="MAC"
    NumberOfAddresses="3"
    Format="XML"
    >
        00:12:80:6D:6A:2A
        00:13:1A:36:3F:E8
        00:10:D6:00:0C:93
</AddressItem>

<AddressItem
    AddressType="MAC"
    NumberOfAddresses="3"
    Format="XDMF"
    >
     <DataItem 
        NumberType="UChar"
        Dimensions="3 6"
        Format="HDF">
        /data/MacAddresses.h5:/Zone1/Addresses
      </DataItem>
</AddressItem>

<PacketItem
    NumberOfPackets="100"
    PacketType="Range"
    Range="0 109"
    Format="PCAP">
    test.pcap
</PacketItem>

<PacketItem
    NumberOfPackets="100"
    PacketType="Filter"
    Filter="src host 10.11.102.23 and dst host 10.11.104.23"
    Format="PCAP">
    test.pcap
</PacketItem>





<Scenario Name="MyScenario">

  <Node Name="Person1"  NodeId="0" Position="0.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
      <Stack Name="Ipv4" Addr="10.1.1.1" />
    </Communication>
  </Node>
  <Node Name="Person2"  NodeId="1" Position="1.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
      <Stack Name="Ipv4" Addr="10.1.1.2" />
    </Communication>
  </Node>
  <Node Name="Person3"  NodeId="2" Position="2.0 0.0 0.0">
    <Mobility Reference="/Xdenf/Device[@Name='SUV']" />
    <Communication Reference="/Xdenf/Communication[@Name='SimpleOlsr']" >
      <Stack Name="Ipv4" Addr="10.1.1.3" />
    </Communication>
  </Node>

  <Event Name="Simple OLSR Simulation" StartTime="0.0" Endtime="50.0">
    <Event EventType="Movement" StartTime="0.1" EndTime="0.2" NodeId="1" Dest="1.0 1.0 0.0" />
    <Event EventType="Movement" StartTime="0.1" EndTime="0.3" NodeId="2" Dest="2.0 2.0 0.0" />
    <Event EventType="Comm" StartTime="0.15" EndTime="1.2">
      <Conversation Type="IPV4" SrcNode="1" DestNode="2">
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
      </Conversation>
      <Conversation Type="IPV4" SrcNode="0" DestNode="2">
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
        <Packet>
          ReferenceToPacketHeavyData XML | MySQL
        </Packet>
      </Conversation>
    </Event>
    <Event EventType="Comm" StartTime="2.0" EndTime="30.0" NodeId="1">
      <Application ApplicationType="HttpServer">
      </Application>
    </Event>
  </Event>


  <Event EventType="Collection" CollectionType="Temporal" 
         Name="Simple OLSR Simulation" StartTime="0.0" Endtime="50.0">
    <Event EventType="Collection" CollectionType="Temporal" 
           StartTime="0.0" Endtime="1.0">
      <Event  EventType="Movement" NodeId="2">
              <Movement MovementType="Path" PathPositionType="GeoSpatial"
                        Interval="1.0" PathLength="2">
                <DataItem  NumberType="Float" Dimensions="3 4" Format="XML">
	                35.0   75.0  1.0
	                35.15 75.0  1.0
                </DataItem>
              </Movement>
      </Event>
      <Event  EventType="Comm" CommType="EndPoint" EndPointType="IPV4">
        <AddressItem
           AddressType="IPV4"
           NumberOfAddresses="3"
           Format="XML" >
          10.11.102.23
          10.11.104.23
          192.168.0.1
          192.168.0.12
        </AddressItem>
      </Event>
      <Event EventType="Comm" CommType="Conversation">
        <Conversation
           ConversationType="IPV4"
           EndPointA="10.11.102.23"
           EndPointB="10.11.104.23">
          <PacketItem
             NumberOfPackets="100"
             PacketType="Filter"
             Filter="src host 10.11.102.23 and dst host 10.11.104.23"
             Format="PCAP">
            test.pcap
          </PacketItem>
          <Traffic
	           TrafficType="bin"
	           Units="bytes"
	           Interval="0.1">
            <DataItem NumberType="Float" Dimensions="10" Format="XML">
              0.0 0.0 0.0 0.0 356.0 500.0 500.0 0.0 0.0 0.0
            </DataItem>
          </Traffic>
        </Conversation>
      </Event>
    </Event>
    <!--	Events for time 1.0 – 2.0
    <Event EventType="Collection" StartTime="1.0" Endtime="2.0">
      
    </Event>
    -->
  </Event>
</Scenario>

</Xdenf>

NetDMF represented into a graph

Vertices

  • Nodes have just a few attributes (mainly number/text)
  • Nodes are linked to many other nodes

NetDMF Elements

  • AddressItem
<AddressItem
    AddressType="IPV4" 
    NumberOfAddresses"4" 
    Format="XML">
        10.11.102.23
        10.11.104.23
        192.168.0.1
        192.168.0.12
</AddressItem>

or

<AddressItem
    AddressType="ETH" 
    NumberOfAddresses"3" 
    Format="XDMF" >
    <DataItem 
        NumberType="UChar" 
        Dimensions="3 6" 
        Format="HDF">
        /data/MacAddresses.h5:/Zone1/Addresses
    </DataItem>
 </AddressItem>

Can be accessed directly from the root, from a device or from a node

  • Application
<Event EventType="Communication" CommunicationType="Application" StartTime="1.0">
  <Application NodeId="4" Name="Ipv4Ping">
    <Parameter Name="RemoteAddress" Value="10.1.1.1"/>
    <Parameter Name="Interval" Value="1.0"/>
  </Application>
</Event>
  • Channel
 <Device Name="Cat6" DeviceType="Communication">
    <Parameter Name="MaxRate" Value="100E06" />
 </Device>
 <Channel Name="Cables" ChannelType="Duplex">
    <Device Reference="/NetDMF/Device[@Name='Cat6']" />
      /NetDMF/Scenario/Node[3]/Device
      /NetDMF/Scenario/Node[4]/Device[2]
      /NetDMF/Scenario/Node[@Name='Server']/Device[1]
</Channel>
  • Conversation
 <Event EventType="Comm" CommType="Conversation" StartTime="12345">
    <Conversation
        StartTime="12345"
        ConversationType="IPV4"
        EndPointA="10.11.102.23"
        EndPointB="10.11.104.23">
        <PacketItem
            NumberOfPackets="100"
            PacketType="Filter"
            Filter="src host 10.11.102.23 and dst host 10.11.104.23"
            Format="PCAP">
            test.pcap
         </PacketItem>
         <Traffic
            TrafficType="bin"
            Direction"AtoB"
            Units="bytes"
            Interval="0.1">
            <DataItem NumberType="Float" Dimensions="10" Format="XML">
                 0.0 0.0 0.0 0.0 356.0 500.0 500.0 0.0 0.0 0.0
            </DataItem>
         </Traffic>
     </Conversation>
 </Event>
  • Device
 <Device Name="HMMWV" DeviceType="Communication">
    <Parameter ... >
    <Parameter ... >
 </Device>


 <Device Name="RadioType1" DeviceType="Communication">
   <Parameter Name="DataRate" Value="300000" />
   <Parameter Name="Delay" Value="2.5" />
 </Device>

 <Device Name="HMMWV" DeviceType="Mobility">
   <Parameter Name="Wheels" Value="4" />
   <Parameter Name="TopSpeed" Value="20.0" />
   <Device Reference="/NetDMF/Device[@Name='RadioType1']" >
       <Stack Reference="/NetDMF/Stack[@Name='SimpleOlsr']" />
       <Stack Reference="/NetDMF/Stack[@Name='MyExperimentalProtocol']" />
   </Device>
 </Device>
    • Typically a radio or a vehicule
    • A device can contain other devices : a vehicule (Mobility device) can contain a radio, a GPS, a wifi modem...
  • Event
 <Result>
 <Event EventType="Collection" CollectionType="Temporal" 
 Name="Simple OLSR Simulation" StartTime="0.0" Endtime="50.0">
 <Event EventType="Collection" CollectionType="Temporal"
 StartTime="0.0" Endtime="1.0">
 <Event  EventType="Movement" 
    NodeId="2"
        <Movement 
            MovementType="Path"
            PathType="TimeLatLonHeight"
            PathLength="2">
        <DataItem  NumberType="Float" Dimensions="3 4" Format="XML">
    0.0        35.0   75.0  1.0
    1.0        35.15 75.0  1.0
        </DataItem>
        </Movement>
 </Event>
 <Event  EventType="Comm" CommType="EndPoint" EndPointType="IPV4">
 <AddressItem
    AddressType="IPV4" 
    NumberOfAddresses"4" 
    Format="XML" >
        10.11.102.23
        10.11.104.23
        192.168.0.1
        192.168.0.12
 </AddressItem>
 </Event>
 <Event EventType="Comm" CommType="Conversation">
 <Conversation
 ConversationType="IPV4"
 EndPointA="10.11.102.23"
 EndPointB="10.11.104.23">
 <PacketItem
    NumberOfPackets="100" 
    PacketType="Filter" 
    Filter="src host 10.11.102.23 and dst host 10.11.104.23" 
    Format="PCAP">
    test.pcap
 </PacketItem>
 <Traffic
    TrafficType="Bin"
    Units="Bytes"
    Interval="0.1">
 <DataItem NumberType="Float" Dimensions="10" Format="XML">
 0.0 0.0 0.0 0.0 356.0 500.0 500.0 0.0 0.0 0.0
 </DataItem>
 </Traffic>
 </Conversation>
 </Event>
 <Event EventType="Comm" CommType="PacketCapture">
   <Parameter Name="NodeId" Value="1"/>
   <Parameter Name="DeviceId" Value="0"/>
   <PacketItem Format="PCAP">
     test1_n1d0.pcap
   </PacketItem>
 </Event>
 </Event>
 <Event EventType="Collection" StartTime="1.0" Endtime="2.0">
    Events for time 1.0 2.0
 </Event>
 Etc.......
 </Event>
 </Result>
  • Movement
       <Movement
           MovementType="Model"
           ModelName="RandomWalk"
           ModelData="interval=1.0s maxspeed=0.5m/s"
       </Movement>
       <Movement 
           MovementType="Path"
           Interval="1.0"
           PathPositionType="GeoSpatial" >
           <DataItem  NumberType="Float" Dimensions="3 4" Format=XML>
                   35.0  75.0  1.0
                   35.15 75.0  1.0
                   35.25 75.0  1.0
                   35.35 75.0  1.0
            </DataItem>
       </Movement>
  • Node
 <Node Name="Person1" NodeId="1">
    <Device ... >
    <Stack... >
 </Node>
  • PacketData

NetDMFPacketData contains the data from a single PacketItem.

  • PacketItem
 <PacketItem
    NumberOfPackets="100"
    PacketType="Range"
    Range="0 109"
    Format="PCAP">
        foo1.pcap
 </PacketItem>

 <PacketItem
    NumberOfPackets="100"
    PacketType="Filter"
    Filter="src host 10.11.102.23 and dst host 10.11.104.23"
    Format="PCAP">
        foo2.pcap
 </PacketItem>

or

 <PacketItem
    PacketType="ETH" 
    NumberOfPackets="X" 
    Format="XDMF" >
    <DataItem 
        NumberType="UChar" 
        Dimensions="X ?" 
        Format="HDF">
        /data/MacPackets.h5:/Zone1/Packets
    </DataItem>
 </PacketItem>
  • Parameter
 <Parameter Name="Wheels" Value="4"/>
 <Parameter Name="TopSpeed" Value="45"/>
 <Parameter Name="MaxConnections" Value="100000"/>
 <Parameter Name="Manufacturer" Value="Acme"/>
  • Platform

A Platform contains a "platform" definition which is a collection of nodes. It has many of the properties of a node.

 <Platform Name="Rack1">
    <Node/>
    <Node/>
    <Node/>
    <Parameter/>
 </Platform>
  • Protocol

Defined only once

<Protocol Name="Ethernet" Type="Link"/>
<Protocol Name="IP" Type="Network"/>
<Protocol Name="TCP" Type="Transport"/>
<Protocol Name="OLSR" Type="Routing"/>
  • Result
<Result Name="Simulation Run 1" >
  <Event/>
</Result>
  • Root
<NetDMF Version="2.0" xmlns:xi="http://www.w3.org/2003/XInclude">
  • Scenario
 <Scenario Name="Simuation 1 Scenario">
    <Protocol/>
    <Node/>
    <Event/>
    <Parameter/>
    <Channel/>
    <Platform/>
 </Scenario>
  • Stack
 <Stack Name="Radio Stack 7">
    <Protocol... >
    <Protocol... >
    <Protocol... >
    <Parameter... >
 </Stack>
  • TimeElement

Parent class for Elements that contain StartTime information

  • Traffic
<Traffic
   TrafficType="Bin"
   Units="Bytes"
   Interval="0.1">
    <DataItem NumberType="Float" Dimensions="10" Format="XML">
      0.0 0.0 0.0 0.0 356.0 500.0 500.0 0.0 0.0 0.0
    </DataItem>
 </Traffic>

NetDMF class

class XDMF_EXPORT NetDMFDevice : public NetDMFElement {

public :
    NetDMFDevice();
    virtual ~NetDMFDevice();
    XdmfConstString GetClassName() { return("NetDMFDevice"); } ;

//! Set the Name of this Device
    XdmfSetStringMacro(Name);
    XdmfGetStringMacro(Name);

//! Set Device Type as integer
/*!
Valid Types are:
\verbatim
NETDMF_DEVICE_TYPE_MOBILITY
NETDMF_DEVICE_TYPE_COMMUNICATION
NETDMF_DEVICE_TYPE_UNSET
\endverbatim
*/
    XdmfSetValueMacro(DeviceType, XdmfInt64);
    XdmfInt32 SetDeviceTypeFromString(XdmfConstString DeviceType);
    XdmfGetValueMacro(DeviceType, XdmfInt64);
    XdmfConstString GetDeviceTypeAsString();

//! Set PacketItem.
/*!
Returns XDMF_SUCCESS or XDMF_FAIL.
*/
    XdmfInt32 SetPacketItem(NetDMFPacketItem *PacketItem);
    NetDMFPacketItem *GetPacketItem();

//! Insert a Child element
/*!
Insert a Child element of type NetDMFParameter, NetDMFDevice,
NetDMFAddressItem, NetDMFPacketItem, or NetDMFStack.  Returns XDMF_SUCCESS
or XDMF_FAIL
*/
    XdmfInt32 Insert(NetDMFElement *Child);

    NetDMFParameter *GetParameter(XdmfInt64 Index);
    NetDMFParameter *GetParameter(XdmfString Name, XdmfInt64 Index=0);
    XdmfInt64 GetNumberOfParameters();
    
    NetDMFStack *GetStack(XdmfInt64 Index);
    NetDMFStack *GetStack(XdmfString Name, XdmfInt64 Index);
    XdmfInt64 GetNumberOfStacks();

    NetDMFDevice *GetDevice(XdmfInt64 Index);
    XdmfInt64 GetNumberOfDevices();

    NetDMFAddressItem *GetAddress(XdmfInt64 Index);
    XdmfInt64 GetNumberOfAddressItems();


//! Update Structure From XML (INPUT)
    XdmfInt32 UpdateInformation();

//! Update Structre and Values potentially reading Heavy Data (INPUT)
    XdmfInt32 Update();

//! Update the DOM (OUTPUT)
    XdmfInt32 Build();

protected :
    XdmfString          Name;
    XdmfInt32           DeviceType;
    NetDMFPacketItem    *PacketItem;
    NetDMFDeviceHelper  *Helper;
};
class NetDMFDeviceHelper {
    public :
        NetDMFDeviceHelper(){};
        ~NetDMFDeviceHelper(){};

        std::vector<NetDMFParameter *>     Parameters;
        std::vector<NetDMFDevice *>        Devices;
        std::vector<NetDMFAddressItem *>   Addresses;
        std::vector<NetDMFStack *>         Stacks;
};


NetDMFDevice::NetDMFDevice(){
    this->SetElementName("Device");
    this->DeviceType = NETDMF_DEVICE_TYPE_UNSET;
    this->Name = NULL;
    this->PacketItem = NULL;
    this->Helper = new NetDMFDeviceHelper();
}

NetDMFDevice::~NetDMFDevice(){
    if (this->Name != NULL) delete [] this->Name;
    if (this->PacketItem != NULL) delete this->PacketItem;
    this->Helper->Parameters.clear();
    this->Helper->Devices.clear();
    this->Helper->Addresses.clear();
    this->Helper->Stacks.clear();
}

XdmfInt32
NetDMFDevice::SetDeviceTypeFromString(XdmfConstString Type) {
    if (Type == NULL) return(XDMF_FAIL);

    if (XDMF_WORD_CMP(Type, "Mobility")) {
        this->DeviceType = NETDMF_DEVICE_TYPE_MOBILITY;
        return(XDMF_SUCCESS);
    }

    if (XDMF_WORD_CMP(Type, "Communication")) {
        this->DeviceType = NETDMF_DEVICE_TYPE_COMMUNICATION;
        return(XDMF_SUCCESS);
    }

    return(XDMF_FAIL);
}

XdmfConstString
NetDMFDevice::GetDeviceTypeAsString() {
    switch(this->DeviceType) {
        case NETDMF_DEVICE_TYPE_MOBILITY :
            return("Mobility");
            break;
        case NETDMF_DEVICE_TYPE_COMMUNICATION :
            return("Communication");
            break;
        default :
            return("Unset");
            break;
    }
    return(NULL);
}

XdmfInt32
NetDMFDevice::Insert(NetDMFElement *Child) {
    XdmfInt32 status = 0;

    if (Child == NULL) {
        XdmfErrorMessage("Child Element is NULL");
        return(XDMF_FAIL);
    }
    if (XDMF_WORD_CMP(Child->GetElementName(), "Parameter")) {
        status = NetDMFElement::Insert(Child);
        if (status != XDMF_SUCCESS) {
            XdmfErrorMessage("Error inserting Parameter Element into Device");
            return(XDMF_FAIL);
        }
        this->Helper->Parameters.push_back((NetDMFParameter *)Child);
    }
    if (XDMF_WORD_CMP(Child->GetElementName(), "Device")) {
        status = NetDMFElement::Insert(Child);
        if (status != XDMF_SUCCESS) {
            XdmfErrorMessage("Error inserting Device Element into Device");
            return(XDMF_FAIL);
        }
        this->Helper->Devices.push_back((NetDMFDevice *)Child);
    }
    if (XDMF_WORD_CMP(Child->GetElementName(), "AddressItem")) {
        status = NetDMFElement::Insert(Child);
        if (status != XDMF_SUCCESS) {
            XdmfErrorMessage("Error inserting AddressItem Element into Device");
            return(XDMF_FAIL);
        }
        this->Helper->Addresses.push_back((NetDMFAddressItem *)Child);
    }
    if (XDMF_WORD_CMP(Child->GetElementName(), "Stack")) {
        status = NetDMFElement::Insert(Child);
        if (status != XDMF_SUCCESS) {
            XdmfErrorMessage("Error inserting Stack Element into Device");
            return(XDMF_FAIL);
        }
        this->Helper->Stacks.push_back((NetDMFStack *)Child);
    }
    if (XDMF_WORD_CMP(Child->GetElementName(), "PacketItem")) {
        status = NetDMFElement::Insert(Child);
        if (status != XDMF_SUCCESS) {
            XdmfErrorMessage("Error inserting PacketItem Element into Device");
            return(XDMF_FAIL);
        }
        if (this->PacketItem != NULL) delete this->PacketItem;
        this->PacketItem = (NetDMFPacketItem *)Child;
    }

    return(XDMF_SUCCESS);
}

NetDMFStack *
NetDMFDevice::GetStack(XdmfInt64 Index) {
    if (this->Helper->Stacks.size() <= Index) return(NULL);
    return(this->Helper->Stacks[Index]);
}

NetDMFStack *
NetDMFDevice::GetStack(XdmfString Name, XdmfInt64 Index) {
    XdmfInt64 paramIndex = 0;
    XdmfInt64 nameIndex = 0;

    if (Name == NULL) return(NULL);

    for (paramIndex = 0; paramIndex < this->Helper->Stacks.size(); paramIndex++) {
        if (XDMF_WORD_CMP(this->Helper->Stacks[paramIndex]->GetName(), Name)) {
            if (Index == nameIndex) return(this->Helper->Stacks[paramIndex]);
            nameIndex++;
        }
    }
    return(NULL);
}

XdmfInt64
NetDMFDevice::GetNumberOfStacks() {
    return(this->Helper->Stacks.size());
}

NetDMFParameter *
NetDMFDevice::GetParameter(XdmfInt64 Index) {
    if (this->Helper->Parameters.size() <= Index) return(NULL);
    return(this->Helper->Parameters[Index]);
}

NetDMFParameter *
NetDMFDevice::GetParameter(XdmfString Name, XdmfInt64 Index) {
    XdmfInt64 paramIndex = 0;
    XdmfInt64 nameIndex = 0;

    if (Name == NULL) return(NULL);

    for (paramIndex = 0; paramIndex < this->Helper->Parameters.size(); paramIndex++) {
        if (XDMF_WORD_CMP(this->Helper->Parameters[paramIndex]->GetName(), Name)) {
            if (Index == nameIndex) return(this->Helper->Parameters[paramIndex]);
            nameIndex++;
        }
    }
    return(NULL);
}

XdmfInt64
NetDMFDevice::GetNumberOfParameters() {
    return(this->Helper->Parameters.size());
}

NetDMFDevice *
NetDMFDevice::GetDevice(XdmfInt64 Index) {
    if (this->Helper->Devices.size() <= Index) {
        XdmfErrorMessage("Invalid Index Value");
        return(NULL);
    }
    return(this->Helper->Devices[Index]);
}

XdmfInt64
NetDMFDevice::GetNumberOfDevices() {
    return(this->Helper->Devices.size());
}

NetDMFAddressItem *
NetDMFDevice::GetAddress(XdmfInt64 Index) {
    if (this->Helper->Addresses.size() <= Index) {
        XdmfErrorMessage("Invalid Index Value");
        return(NULL);
    }
    return(this->Helper->Addresses[Index]);
}

XdmfInt64
NetDMFDevice::GetNumberOfAddressItems() {
    return(this->Helper->Addresses.size());
}

XdmfInt32
NetDMFDevice::Build() {
    if(NetDMFElement::Build() != XDMF_SUCCESS) return(XDMF_FAIL);

    this->Set("Name", this->GetName());
    this->Set("DeviceType", this->GetDeviceTypeAsString());

    return(XDMF_SUCCESS);
}

XdmfInt32
NetDMFDevice::UpdateInformation(){
    XdmfConstString Value;
    XdmfInt64 index = 0;
    XdmfXmlNode xmlNode;

    // Call Parent Class
    if(NetDMFElement::UpdateInformation() != XDMF_SUCCESS) return(XDMF_FAIL);

    Value = this->Get("DeviceType");
    if(!Value){
        // Try Type
        Value = this->Get("Type");
    }
    if (Value) this->SetDeviceTypeFromString(Value);

    Value = this->Get("Name");
    if (Value) this->SetName(Value);
    
    for (index = 0;  index < this->DOM->FindNumberOfElements("AddressItem", this->Element); index++) {
        NetDMFAddressItem *ChildAddressItem = NULL;

        xmlNode = this->DOM->FindElement("AddressItem", index, this->Element);
        if (xmlNode == NULL) {
            XdmfErrorMessage("Can't find child AddressItem #" << index);
            return(XDMF_FAIL);
        }
        if (this->Helper->Addresses.size() <= index) {
            ChildAddressItem = new NetDMFAddressItem;
            this->Helper->Addresses.push_back(ChildAddressItem);
        } else {
            ChildAddressItem = this->Helper->Addresses[index];
            if (ChildAddressItem == NULL) {
                ChildAddressItem = new NetDMFAddressItem;
                this->Helper->Addresses[index] = ChildAddressItem;
            }
        }
        if(ChildAddressItem->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildAddressItem->SetElement(xmlNode) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildAddressItem->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
    }
    for (index = 0;  index < this->DOM->FindNumberOfElements("Parameter", this->Element); index++) {
        NetDMFParameter *ChildParameter = NULL;

        xmlNode = this->DOM->FindElement("Parameter", index, this->Element);
        if (xmlNode == NULL) {
            XdmfErrorMessage("Can't find child Parameter #" << index);
            return(XDMF_FAIL);
        }
        if (this->Helper->Parameters.size() <= index) {
            ChildParameter = new NetDMFParameter;
            this->Helper->Parameters.push_back(ChildParameter);
        } else {
            ChildParameter = this->Helper->Parameters[index];
            if (ChildParameter == NULL) {
                ChildParameter = new NetDMFParameter;
                this->Helper->Parameters[index] = ChildParameter;
            }
        }
        if(ChildParameter->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildParameter->SetElement(xmlNode) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildParameter->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
    }
    for (index = 0;  index < this->DOM->FindNumberOfElements("Stack", this->Element); index++) {
        NetDMFStack *ChildStack = NULL;

        xmlNode = this->DOM->FindElement("Stack", index, this->Element);
        if (xmlNode == NULL) {
            XdmfErrorMessage("Can't find child Stack #" << index);
            return(XDMF_FAIL);
        }
        if (this->Helper->Stacks.size() <= index) {
            ChildStack = new NetDMFStack;
            this->Helper->Stacks.push_back(ChildStack);
        } else {
            ChildStack = this->Helper->Stacks[index];
            if (ChildStack == NULL) {
                ChildStack = new NetDMFStack;
                this->Helper->Stacks[index] = ChildStack;
            }
        }
        if(ChildStack->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildStack->SetElement(xmlNode) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildStack->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
    }
    for (index = 0;  index < this->DOM->FindNumberOfElements("Device", this->Element); index++) {
        NetDMFDevice *ChildDevice = NULL;

        xmlNode = this->DOM->FindElement("Device", index, this->Element);
        if (xmlNode == NULL) {
            XdmfErrorMessage("Can't find child Device #" << index);
            return(XDMF_FAIL);
        }
        if (this->Helper->Devices.size() <= index) {
            ChildDevice = new NetDMFDevice;
            this->Helper->Devices.push_back(ChildDevice);
        } else {
            ChildDevice = this->Helper->Devices[index];
            if (ChildDevice == NULL) {
                ChildDevice = new NetDMFDevice;
                this->Helper->Devices[index] = ChildDevice;
            }
        }
        if(ChildDevice->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildDevice->SetElement(xmlNode) == XDMF_FAIL) return(XDMF_FAIL);
        if(ChildDevice->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
    }
    if (this->DOM->FindNumberOfElements("PacketItem") >= 1) {
        NetDMFPacketItem *ChildPacketItem = NULL;

        xmlNode = this->DOM->FindElement("Packetitem", 0, this->Element);
        if (xmlNode == NULL) {
            XdmfErrorMessage("Can't find child PacketItem#" << index);
            return(XDMF_FAIL);
        }
        if (this->PacketItem != NULL) delete this->PacketItem;
        ChildPacketItem = new NetDMFPacketItem;
        if (ChildPacketItem->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
        if (ChildPacketItem->SetElement(xmlNode) == XDMF_FAIL) return(XDMF_FAIL);
        if (ChildPacketItem->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
        this->PacketItem = ChildPacketItem;
    }
    return(XDMF_SUCCESS);
}

XdmfInt32
NetDMFDevice::SetPacketItem(NetDMFPacketItem *pi) {
    if (pi == NULL) return(XDMF_FAIL);
    if (this->PacketItem != NULL) delete this->PacketItem;
    this->PacketItem = pi;
    return(XDMF_SUCCESS);
}

NetDMFPacketItem *
NetDMFDevice::GetPacketItem() {
    return(this->PacketItem);
}

XdmfInt32
NetDMFDevice::Update(){

    if(NetDMFElement::Update() != XDMF_SUCCESS) return(XDMF_FAIL);
    if(this->DeviceType == NETDMF_DEVICE_TYPE_UNSET || this->Name == NULL) {
        if(this->UpdateInformation() == XDMF_FAIL){
            XdmfErrorMessage("Error Initializing Device");
            return(XDMF_FAIL);
       }
    }
    return(XDMF_SUCCESS);
}

Time

  • vtkNetDmfReader output describes time as special nodes, when animating some filters handle these nodes and decide how to display it
  • vtkNetDmfReader sets the Time_Range information key in the pipeline and produces a different graph for every UPDATE_TIME_STEPS

Network

  • Use Channels to represent networks:
    • In a wired or wireless network, a channel specifies physical or logical connectivity to a particular network segment, such as a shared Ethernet or 802.11 network. The NetDMFChannel element contains a list of network devices that are considered to be 'connected' (either physically or logically). The network devices are specified by an XML reference to the definition within a NetDMFNode.
  • can network change over time ? The NetDMF format doesn't seem to allow it.
    • What if a device loses its connection (wifi) or change its IP address ?

Use cases

  • Draw Nodes(Persons) on a 3D environment like geographic map?
  • Focus on node connectivity rather than node attributes ?
  • Draw a graph of all the conversations made by a device with a specific IP address ?

Questions

  • What is a Communication XML tag ?
  • What is a Channel DeviceType
  • is it valid?
<Communication Name="SimpleOlsr" >
   <Stack Reference="/Xdenf/Protocol[@Name='Olsr']" > 
        <Stack Reference="/Xdenf/Protocol[@Name='Udp']" > 
             <Stack Reference="/Xdenf/Protocol[@Name='Ipv4']" > 
                  <Stack Reference="/Xdenf/Protocol[@Name='Ppp']" > 
                       <Channel Reference="/Xdenf/Device[@Name='Radio1']" Delay="1" />
                  </Stack>
              </Stack>
        </Stack>
   </Stack>
</Communication>

How different is it from the code below ?

<Stack Name="SimpleOlsr" >
      <Protocol Template="/NetDMF/Protocol[@Name='Olsr']" /> 
      <Protocol Template="/NetDMF/Protocol[@Name='Udp']" /> 
      <Protocol Template="/NetDMF/Protocol[@Name='Ipv4']" /> 
      <Protocol Template="/NetDMF/Protocol[@Name='Ppp']" />
</Stack>
<Device Template="/NetDMF/Device[@Name='RadioType1']" >
      <Stack Template="/NetDMF/Stack[@Name='SimpleOlsr']" />
 </Device>

Problems with Example1.xmn

  • Line 3: Missing xi namespace description, add
    • current:
<Xdenf>
    • fix:
<Xdenf xmlns:xi="http://www.w3.org/2001/XInclude">
  • Line 4 & 5: Inconsistent DeviceType. Based on doc + NetDMFDevice.{h|cxx}, "Channel" is not a DeviceType. Only Mobility and Communication are.
  • Line 21: Missing file DefaultCommDevices.xdf
    • Created a DefaultCommDevices.xdf file:
<?xml version="1.0" ?>
<Xdenf>
<Device Name="Radar1" DeviceType="Channel" DataRate="50000000" Delay="1"/>
<Device Name="Radar2" DeviceType="Channel" DataRate="10000000" Delay="1"/>
</Xdenf>
  • Line 21: XPointer needs an element type to retrieve
    • current

<xi:include href="DefaultCommDevices.xdf" xpointer="xpointer(//Xdenf[@DeviceType='Channel'])" />

    • fix

<xi:include href="DefaultCommDevices.xdf" xpointer="xpointer(//Xdenf/Device[@DeviceType='Channel'])" />

  • Line 83: Typo, missing closing tag </Application>
    • current
<Application ApplicationType="HttpServer">
<Application>
    • fix
<Application ApplicationType="HttpServer">
</Application>
  • Line 90 & 101 & 111: Typo, missing = char between NumberOfAddresses and "3"
    • current
NumberOfAddresses"3"
    • fix
NumberOfAddresses="3"