[SEBA-624] Implementation of radius server operational status
Cherry-picked from aaa-1.10
Change-Id: I3b70ddfc45c4b9e57c587df671088580c7426a89
diff --git a/app/src/main/java/org/opencord/aaa/impl/StateMachine.java b/app/src/main/java/org/opencord/aaa/impl/StateMachine.java
index 5e9e140..48e4ac0 100644
--- a/app/src/main/java/org/opencord/aaa/impl/StateMachine.java
+++ b/app/src/main/java/org/opencord/aaa/impl/StateMachine.java
@@ -17,19 +17,18 @@
package org.opencord.aaa.impl;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.Maps;
import org.onlab.packet.MacAddress;
import org.onosproject.net.ConnectPoint;
import org.opencord.aaa.AuthenticationEvent;
import org.opencord.aaa.StateMachineDelegate;
import org.slf4j.Logger;
-import com.google.common.collect.Maps;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
/**
* AAA Finite State Machine.
@@ -56,7 +55,7 @@
static final int TRANSITION_DENY_ACCESS = 3;
static final int TRANSITION_LOGOFF = 4;
- private static int identifier = -1;
+ private static int identifier = 1;
private byte challengeIdentifier;
private byte[] challengeState;
private byte[] username;
@@ -129,7 +128,7 @@
public static void initializeMaps() {
sessionIdMap = Maps.newConcurrentMap();
identifierMap = Maps.newConcurrentMap();
- identifier = -1;
+ identifier = 1;
}
public static void destroyMaps() {
@@ -207,7 +206,7 @@
if (e.getValue() != null && e.getValue().supplicantAddress != null
&& e.getValue().supplicantAddress.equals(mac)) {
sessionIdMap.remove(e.getValue().sessionId);
- if (e.getValue().identifier != -1) {
+ if (e.getValue().identifier != 1) {
deleteStateMachineMapping(e.getValue());
}
break;
@@ -419,9 +418,11 @@
* @return The state machine identifier.
*/
public synchronized byte identifier() {
- identifier = (identifier + 1) % 255;
- identifierMap.put(identifier, this);
- return (byte) identifier;
+ //identifier 0 is for statusServerrequest
+ //identifier 1 is for fake accessRequest
+ identifier = (identifier + 1) % 253;
+ identifierMap.put((identifier + 2), this);
+ return (byte) (identifier + 2);
}
/**