@@ -0,0 +1,2306 @@
+package net.floodlightcontroller.odinmaster;%0A%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.ConcurrentMap;%0A%0Aimport net.floodlightcontroller.odinmaster.NotificationCallback;%0Aimport net.floodlightcontroller.odinmaster.NotificationCallbackContext;%0Aimport net.floodlightcontroller.odinmaster.OdinApplication;%0Aimport net.floodlightcontroller.odinmaster.OdinClient;%0Aimport net.floodlightcontroller.odinmaster.OdinEventSubscription;%0Aimport net.floodlightcontroller.odinmaster.OdinEventSubscription.Relation;%0Aimport net.floodlightcontroller.util.MACAddress;%0A%0Apublic class OdinMobilityManager extends OdinApplication %7B%0A%09%0A%09private ConcurrentMap%3CMACAddress, Long%3E clientCurrentSignalMap = new ConcurrentHashMap%3CMACAddress, Long%3E ();%0A%09%0A%09private void init () %7B%0A%09%09OdinEventSubscription oes1 = new OdinEventSubscription();%0A%09%09oes1.setSubscription(%22*%22, %22signal%22, Relation.GREATER_THAN, 200);%09%09%0A%09%09%0A%09%09NotificationCallback cb = new NotificationCallback() %7B%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void exec(OdinEventSubscription oes, NotificationCallbackContext cntx) %7B%0A%09%09%09%09handler(oes, cntx);%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09%0A%09%09odinApplicationInterface.registerSubscription(oes1, cb);%0A%09%7D%0A%09%0A%09@Override%0A%09public void run() %7B%0A%09%09init ();%0A%09%7D%0A%09%0A%09/**%0A%09 * This handler will handoff a client in the event of its%0A%09 * agent having failed.%0A%09 * %0A%09 * @param oes%0A%09 * @param cntx%0A%09 */%0A%09private void handler (OdinEventSubscription oes, NotificationCallbackContext cntx) %7B%0A%09%09// Check to see if this is an associated client%0A%09%09OdinClient client = odinApplicationInterface.getClients().get(cntx.clientHwAddress);%0A%0A%09%09if (client != null) %7B%0A%09%09%09// The agent that triggered this handler is the one%0A%09%09%09// hosting the client's LVAP%0A%09%09%09if (client.getOdinAgent() != null && client.getOdinAgent().getIpAddress() == cntx.agent.getIpAddress()) %7B%0A%09%09%09%09clientCurrentSignalMap.put(cntx.clientHwAddress, cntx.value);%0A%09%09%09%7D%0A%09%09%09else if ((client.getOdinAgent() == null) %7C%7C %0A%09%09%09%09%09 (client.getOdinAgent().getIpAddress() != cntx.agent.getIpAddress()%0A%09%09%09%09%09  && clientCurrentSignalMap.get(cntx.clientHwAddress) != null%0A%09%09%09%09%09  && clientCurrentSignalMap.get(cntx.clientHwAddress) + 10 %3C cntx.value)) %7B%0A%09%09%09%09odinApplicationInterface.handoffClientToAp(cntx.clientHwAddress, cntx.agent.getIpAddress());%0A%09%09%09%09clientCurrentSignalMap.put(cntx.clientHwAddress, cntx.value);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add mobility manager