Thursday 20 February 2014

Hierarchical Topology


The GEXF file format contains a hierarchical network topology which is very distinct from the others.

In the GEXF file we have 3 main entities involved.

1. The Antenna : The Antenna is where wireless communication between nodes are established. Yet, it's not very distinctively clear on how to determine using queries if a node is an antenna but, the Antenna can be found as the source of a wired edge and also the source or destination of a wireless edge.

2. The Router : The router is a node that has many IPs ( to be more distinctive, the node name is not an IP adress), the node name of a router is the parent ID of the interfaces.

3. The Interfaces : The Interfaces are all nodes that have a parent ID (router).

The edge connections,

All Interfaces are connected to a particular antenna using a wired link while, for wireless communication, the Antenna IP is used to link up to other neighboring nodes.


A diagram of the entities involved.


Now with the PICTURE, in mind.  The GEXF file has interface, antennas and routers as nodes. And this is also how it is represented inside the MYSQL database. In other for me to have the hierarchical representation, an option could be to use the appropriate mysql queries that will retrieve these nodes from the database and properly present them in the right json structure.

The JSON structure for node representation in Libremap is :



To represent a node, I plan to do the following :

{
  "_id": "TheRouterID(PID)",
  "type": "router",
  "hostname": "hostname of router",
  "lat": -31.805412,
  "lon": -64.424677,
  "aliases": [
    {
      All the Interfaces IPs will be here
    {
      Also the Antenna IPs
    }
  ],
  "links": [
    {
      Wired links(Connect all local IPs to Antenna)
    },
    {
      Wireless links (Connect the Antenna to other nodes)
    }
  ],
  "site": "info",
  "community": "info",
  "attributes": {
    "firmware": {
                }
  }
}

These attributes will be retrieved from the database and used to built the json data structure in php that will yield such an output above.




GEXF to JSON(Libremap)

Since the data i will be needing to import into libremap is in GEXF format,  parsing is needed in other to produce the suitable json format for libremap. So first i am inserting this data into mysql which will help me build queries for the insertion into libremap. At the moment using mysql as an intermediary isn't the best possible plan but at the moment is it the most feasible to archive my needs.


This will be an optimal approach for future implementation.