According to the 802.1x standard, the state-machine should go back to connecting state if a start packet is received while in authorized state
Change-Id: I07ef81eb73d2422cbb85b9c8dd9fcd4f48742e2e
diff --git a/src/main/java/org/onosproject/aaa/StateMachine.java b/src/main/java/org/onosproject/aaa/StateMachine.java
index 84f6924..946133d 100644
--- a/src/main/java/org/onosproject/aaa/StateMachine.java
+++ b/src/main/java/org/onosproject/aaa/StateMachine.java
@@ -83,7 +83,7 @@
input
----------------------------------------------------------------------------------------------------
- START STARTED | _ | _ | _ | _
+ START STARTED | _ | _ | STARTED | _
REQUEST_ACCESS _ | PENDING | _ | _ | _
@@ -101,7 +101,7 @@
private int[] pendingTransition =
{STATE_PENDING, STATE_PENDING, STATE_AUTHORIZED, STATE_UNAUTHORIZED, STATE_PENDING};
private int[] authorizedTransition =
- {STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_IDLE};
+ {STATE_STARTED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_AUTHORIZED, STATE_IDLE};
private int[] unauthorizedTransition =
{STATE_UNAUTHORIZED, STATE_UNAUTHORIZED, STATE_UNAUTHORIZED, STATE_UNAUTHORIZED, STATE_IDLE};
@@ -515,6 +515,10 @@
private final Logger log = getLogger(getClass());
private String name = "AUTHORIZED_STATE";
+ public void start() {
+ log.info("Moving from AUTHORIZED state to STARTED state.");
+ }
+
public void logoff() {
log.info("Moving from AUTHORIZED state to IDLE state.");
diff --git a/src/test/java/org/onosproject/aaa/StateMachineTest.java b/src/test/java/org/onosproject/aaa/StateMachineTest.java
index 1838c63..1c09f6e 100644
--- a/src/test/java/org/onosproject/aaa/StateMachineTest.java
+++ b/src/test/java/org/onosproject/aaa/StateMachineTest.java
@@ -175,10 +175,10 @@
stateMachine.authorizeAccess();
stateMachine.start();
- Assert.assertEquals(stateMachine.state(), StateMachine.STATE_AUTHORIZED);
+ Assert.assertEquals(stateMachine.state(), StateMachine.STATE_STARTED);
stateMachine.requestAccess();
- Assert.assertEquals(stateMachine.state(), StateMachine.STATE_AUTHORIZED);
+ Assert.assertEquals(stateMachine.state(), StateMachine.STATE_PENDING);
stateMachine.authorizeAccess();
Assert.assertEquals(stateMachine.state(), StateMachine.STATE_AUTHORIZED);