Ray Milkey
Committed by Gerrit Code Review

Break dependency between AAA app and demo XOS integration app

The XOS integration app was written just for the ONS demo and
is a frequent cause of confusion for people outside the lab.

Change-Id: I03cf592890dc7ae68520bc7b71d99e742a9da74c
......@@ -45,12 +45,6 @@
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-xos-integration</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<scope>test</scope>
</dependency>
......
......@@ -15,7 +15,14 @@
*/
package org.onosproject.aaa;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
......@@ -48,16 +55,9 @@ import org.onosproject.net.packet.OutboundPacket;
import org.onosproject.net.packet.PacketContext;
import org.onosproject.net.packet.PacketProcessor;
import org.onosproject.net.packet.PacketService;
import org.onosproject.xosintegration.VoltTenantService;
import org.slf4j.Logger;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
import static org.onosproject.net.packet.PacketPriority.CONTROL;
......@@ -82,9 +82,6 @@ public class AaaManager {
protected PacketService packetService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected VoltTenantService voltTenantService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected NetworkConfigRegistry netCfgService;
// Parsed RADIUS server addresses
......@@ -331,7 +328,7 @@ public class AaaManager {
String sessionId = deviceId.toString() + portNumber.toString();
StateMachine stateMachine = StateMachine.lookupStateMachineBySessionId(sessionId);
if (stateMachine == null) {
stateMachine = new StateMachine(sessionId, voltTenantService);
stateMachine = new StateMachine(sessionId);
}
......
......@@ -23,8 +23,6 @@ import java.util.Map;
import org.onlab.packet.MacAddress;
import org.onosproject.net.ConnectPoint;
import org.onosproject.xosintegration.VoltTenant;
import org.onosproject.xosintegration.VoltTenantService;
import org.slf4j.Logger;
import com.google.common.collect.Maps;
......@@ -52,7 +50,6 @@ class StateMachine {
//map of access identifiers (issued at EAPOL START)
static BitSet bitSet = new BitSet();
private final VoltTenantService voltService;
private int identifier = -1;
private byte challengeIdentifier;
......@@ -137,12 +134,10 @@ class StateMachine {
* State Machine Constructor.
*
* @param sessionId session Id represented by the switch dpid + port number
* @param voltService volt service reference
*/
public StateMachine(String sessionId, VoltTenantService voltService) {
public StateMachine(String sessionId) {
log.info("Creating a new state machine for {}", sessionId);
this.sessionId = sessionId;
this.voltService = voltService;
sessionIdMap.put(sessionId, this);
}
......@@ -387,16 +382,7 @@ class StateMachine {
//move to the next state
next(TRANSITION_AUTHORIZE_ACCESS);
if (voltService != null) {
voltService.addTenant(
VoltTenant.builder()
.withHumanReadableName("VCPE-" + this.identifier)
.withId(this.identifier)
.withProviderService(1)
.withServiceSpecificId(String.valueOf(this.identifier))
.withPort(this.supplicantConnectpoint)
.withVlanId(String.valueOf(this.vlanId)).build());
}
// TODO: put in calls to launch vSG here
deleteIdentifier();
}
......
......@@ -34,7 +34,7 @@ public class StateMachineTest {
System.out.println("Set Up.");
StateMachine.bitSet.clear();
StateMachine.initializeMaps();
stateMachine = new StateMachine("session0", null);
stateMachine = new StateMachine("session0");
}
@After
......@@ -233,7 +233,7 @@ public class StateMachineTest {
//create 255 others state machines
for (int i = 1; i <= 255; i++) {
StateMachine sm = new StateMachine("session" + i, null);
StateMachine sm = new StateMachine("session" + i);
sm.start();
byte id = sm.identifier();
Assert.assertEquals(i, Byte.toUnsignedInt(id));
......@@ -259,13 +259,13 @@ public class StateMachineTest {
sm3.authorizeAccess();
sm3.logoff();
StateMachine otherSM3 = new StateMachine("session3b", null);
StateMachine otherSM3 = new StateMachine("session3b");
otherSM3.start();
otherSM3.requestAccess();
byte id3 = otherSM3.identifier();
Assert.assertEquals(3, Byte.toUnsignedInt(id3));
StateMachine otherSM247 = new StateMachine("session247b", null);
StateMachine otherSM247 = new StateMachine("session247b");
otherSM247.start();
otherSM247.requestAccess();
byte id247 = otherSM247.identifier();
......@@ -285,8 +285,8 @@ public class StateMachineTest {
StateMachine.lookupStateMachineBySessionId(sessionId2);
assertNull(machine2ShouldBeNull);
StateMachine stateMachine1 = new StateMachine(sessionId1, null);
StateMachine stateMachine2 = new StateMachine(sessionId2, null);
StateMachine stateMachine1 = new StateMachine(sessionId1);
StateMachine stateMachine2 = new StateMachine(sessionId2);
assertEquals(stateMachine1,
StateMachine.lookupStateMachineBySessionId(sessionId1));
......@@ -307,9 +307,9 @@ public class StateMachineTest {
StateMachine.lookupStateMachineById((byte) 2);
assertNull(machine2ShouldBeNull);
StateMachine stateMachine1 = new StateMachine(sessionId1, null);
StateMachine stateMachine1 = new StateMachine(sessionId1);
stateMachine1.start();
StateMachine stateMachine2 = new StateMachine(sessionId2, null);
StateMachine stateMachine2 = new StateMachine(sessionId2);
stateMachine2.start();
assertEquals(stateMachine1,
......