Jump to: navigation, search

L2 Switch:HostTracker

Introduction

HostTracker is an attempt to bring the ideas of the AD-SAL hosttracker and hosttracker_new bundles to the MD-SAL. See below for a guide to pulling and running the MdHostTracker code within the l2switch base distribution.

User Guide

The HostTracker code is currently hosted on l2switch project, you can clone the code:

   git clone https://git.opendaylight.org/gerrit/p/l2switch.git

Once you've cloned the code you can build it:

   mvn clean install

You should also be able to import the code to Eclipse with no problems via Import > Existing Maven Project(s), use the pom.xml in the hosttracker's directory (l2switch/hosttracker/pom.xml). If for some reason you get errors resolving generated classes add the generated source path to the project's source directories via Project Preferences > Java Build Path > Source > Add folder... The path you're looking for is src/main/yang-gen-code.

HostTracker depends on the l2switch addresstracker for its observations, so we will run within the l2switch distribution for testing. Build l2switch as you usually would (mvn clean install) and the hosttracker model and implementation bundles are inside the plugins' folder, in the directory:

   ~/path/to/l2switch/distribution/base/target/distributions-l2switch-base-0.1.0-SNAPSHOT-osgipackage/opendaylight/

Now you're ready to run the distribution, to test with mininet run

   ./run.sh -start
   sudo mn --topo linear,3 --mac --switch ovsk --controller remote

And inside mininet run

   pingall

To see learned hosts visit: http://localhost:8080/restconf/operational/network-topology:network-topology/topology/flow:1/ You should see something similar to this:

{
 "topology": [
   {
     "link": [
       {
         "source": {
           "source-tp": "openflow:2:1",
           "source-node": "openflow:2"
         },
         "link-id": "openflow:2:1/host:00:00:00:00:00:02:0",
         "destination": {
           "dest-node": "host:00:00:00:00:00:02",
           "dest-tp": "host:00:00:00:00:00:02:0"
         }
       }, ...
       {
         "source": {
           "source-tp": "host:00:00:00:00:00:01:0",
           "source-node": "host:00:00:00:00:00:01"
         },
         "link-id": "host:00:00:00:00:00:01:0/openflow:1:1",
         "destination": {
           "dest-node": "openflow:1",
           "dest-tp": "openflow:1:1"
         }
       },
       {
         "source": {
           "source-tp": "host:00:00:00:00:00:03:0",
           "source-node": "host:00:00:00:00:00:03"
         },
         "link-id": "host:00:00:00:00:00:03:0/openflow:3:1",
         "destination": {
           "dest-node": "openflow:3",
           "dest-tp": "openflow:3:1"
         }
       },
       {
         "source": {
           "source-tp": "openflow:3:1",
           "source-node": "openflow:3"
         },
         "link-id": "openflow:3:1/host:00:00:00:00:00:03:0",
         "destination": {
           "dest-node": "host:00:00:00:00:00:03",
           "dest-tp": "host:00:00:00:00:00:03:0"
         }
       },
       {
         "source": {
           "source-tp": "openflow:1:1",
           "source-node": "openflow:1"
         },
         "link-id": "openflow:1:1/host:00:00:00:00:00:01:0",
         "destination": {
           "dest-node": "host:00:00:00:00:00:01",
           "dest-tp": "host:00:00:00:00:00:01:0"
         }
       }, ... ,
       {
         "source": {
           "source-tp": "host:00:00:00:00:00:02:0",
           "source-node": "host:00:00:00:00:00:02"
         },
         "link-id": "host:00:00:00:00:00:02:0/openflow:2:1",
         "destination": {
           "dest-node": "openflow:2",
           "dest-tp": "openflow:2:1"
         }
       }, ... 
     ],
     "topology-id": "flow:1",
     "node": [
       {
         ... ,
         ... ,
       {
         "node-id": "host:00:00:00:00:00:01",
         "termination-point": [
           {
             "tp-id": "host:00:00:00:00:00:01:0"
           }
         ],
         "host-tracker-service:id": "00:00:00:00:00:01",
         "host-tracker-service:attachment-points": [
           {
             "host-tracker-service:tp-id": "openflow:1:1"
           }
         ],
         "host-tracker-service:addresses": [
           {
             "host-tracker-service:first-seen": 1407779638958,
             "host-tracker-service:mac": "00:00:00:00:00:01",
             "host-tracker-service:last-seen": 1407779424902,
             "host-tracker-service:id": 42,
             "host-tracker-service:ip": "10.0.0.1"
           },
           {
             "host-tracker-service:first-seen": 1407779282366,
             "host-tracker-service:mac": "00:00:00:00:00:01",
             "host-tracker-service:last-seen": 1407779274363,
             "host-tracker-service:id": 1,
             "host-tracker-service:ip": "fe80:0:0:0:200:ff:fe00:1"
           }
         ]
       },
       ... ,
       {
         "node-id": "host:00:00:00:00:00:02",
         "termination-point": [
           {
             "tp-id": "host:00:00:00:00:00:02:0"
           }
         ],
         "host-tracker-service:id": "00:00:00:00:00:02",
         "host-tracker-service:attachment-points": [
           {
             "host-tracker-service:tp-id": "openflow:2:1"
           }
         ],
         "host-tracker-service:addresses": [
           {
             "host-tracker-service:first-seen": 1407779639006,
             "host-tracker-service:mac": "00:00:00:00:00:02",
             "host-tracker-service:last-seen": 1407779424913,
             "host-tracker-service:id": 44,
             "host-tracker-service:ip": "10.0.0.2"
           },
           {
             "host-tracker-service:first-seen": 1407779283245,
             "host-tracker-service:mac": "00:00:00:00:00:02",
             "host-tracker-service:last-seen": 1407779275339,
             "host-tracker-service:id": 32,
             "host-tracker-service:ip": "fe80:0:0:0:200:ff:fe00:2"
           }
         ]
       },
       {
         "node-id": "host:00:00:00:00:00:03",
         "termination-point": [
           {
             "tp-id": "host:00:00:00:00:00:03:0"
           }
         ],
         "host-tracker-service:id": "00:00:00:00:00:03",
         "host-tracker-service:attachment-points": [
           {
             "host-tracker-service:tp-id": "openflow:3:1"
           }
         ],
         "host-tracker-service:addresses": [
           {
             "host-tracker-service:first-seen": 1407779639022,
             "host-tracker-service:mac": "00:00:00:00:00:03",
             "host-tracker-service:last-seen": 1407779638983,
             "host-tracker-service:id": 47,
             "host-tracker-service:ip": "10.0.0.3"
           },
           {
             "host-tracker-service:first-seen": 1407779283117,
             "host-tracker-service:mac": "00:00:00:00:00:03",
             "host-tracker-service:last-seen": 1407779275113,
             "host-tracker-service:id": 20,
             "host-tracker-service:ip": "fe80:0:0:0:200:ff:fe00:3"
           }
         ]
       }
     ]
   }
 ]
}