Fix naming conventions for CORD apps.
Change-Id: I0b1d4dd276301b726269376eec137511c8e0a805
diff --git a/src/main/java/org/onosproject/aaa/AAAConfig.java b/src/main/java/org/onosproject/aaa/AaaConfig.java
similarity index 97%
rename from src/main/java/org/onosproject/aaa/AAAConfig.java
rename to src/main/java/org/onosproject/aaa/AaaConfig.java
index 73be769..db821ca 100644
--- a/src/main/java/org/onosproject/aaa/AAAConfig.java
+++ b/src/main/java/org/onosproject/aaa/AaaConfig.java
@@ -15,17 +15,17 @@
*/
package org.onosproject.aaa;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
import org.onosproject.core.ApplicationId;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.basics.BasicElementConfig;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
/**
* Network config for the AAA app.
*/
-public class AAAConfig extends Config<ApplicationId> {
+public class AaaConfig extends Config<ApplicationId> {
private static final String RADIUS_IP = "radiusIp";
private static final String RADIUS_SERVER_PORT = "1812";
@@ -221,7 +221,7 @@
*
* @return radius server UDP port.
*/
- public short radiusServerUDPPort() {
+ public short radiusServerUdpPort() {
return Short.parseShort(getStringProperty(RADIUS_SERVER_PORT,
DEFAULT_RADIUS_SERVER_PORT));
}
@@ -232,7 +232,7 @@
* @param port new RADIUS UDP port; -1 to clear
* @return self
*/
- public BasicElementConfig radiusServerUDPPort(short port) {
+ public BasicElementConfig radiusServerUdpPort(short port) {
return (BasicElementConfig) setOrClear(RADIUS_SERVER_PORT, (long) port);
}
diff --git a/src/main/java/org/onosproject/aaa/AAA.java b/src/main/java/org/onosproject/aaa/AaaManager.java
similarity index 93%
rename from src/main/java/org/onosproject/aaa/AAA.java
rename to src/main/java/org/onosproject/aaa/AaaManager.java
index 567944a..dd324ee 100644
--- a/src/main/java/org/onosproject/aaa/AAA.java
+++ b/src/main/java/org/onosproject/aaa/AaaManager.java
@@ -15,14 +15,7 @@
*/
package org.onosproject.aaa;
-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 org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -58,7 +51,13 @@
import org.onosproject.xosintegration.VoltTenantService;
import org.slf4j.Logger;
-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 static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
import static org.onosproject.net.packet.PacketPriority.CONTROL;
@@ -68,7 +67,7 @@
* AAA application for ONOS.
*/
@Component(immediate = true)
-public class AAA {
+public class AaaManager {
// for verbose output
private final Logger log = getLogger(getClass());
@@ -122,12 +121,12 @@
// Configuration properties factory
private final ConfigFactory factory =
- new ConfigFactory<ApplicationId, AAAConfig>(APP_SUBJECT_FACTORY,
- AAAConfig.class,
+ new ConfigFactory<ApplicationId, AaaConfig>(APP_SUBJECT_FACTORY,
+ AaaConfig.class,
"AAA") {
@Override
- public AAAConfig createConfig() {
- return new AAAConfig();
+ public AaaConfig createConfig() {
+ return new AaaConfig();
}
};
@@ -175,7 +174,7 @@
// "org.onosproject.aaa" is the FQDN of our app
appId = coreService.registerApplication("org.onosproject.aaa");
- cfgListener.reconfigureNetwork(netCfgService.getConfig(appId, AAAConfig.class));
+ cfgListener.reconfigureNetwork(netCfgService.getConfig(appId, AaaConfig.class));
// register our event handler
packetService.addProcessor(processor, PacketProcessor.director(2));
@@ -207,7 +206,7 @@
executor.shutdownNow();
}
- protected void sendRADIUSPacket(RADIUS radiusPacket) {
+ protected void sendRadiusPacket(RADIUS radiusPacket) {
try {
final byte[] data = radiusPacket.serialize();
@@ -305,7 +304,7 @@
stateMachine.username());
radiusPayload.setAttribute(RADIUSAttribute.RADIUS_ATTR_NAS_IP,
- AAA.this.nasIpAddress.getAddress());
+ AaaManager.this.nasIpAddress.getAddress());
radiusPayload.encapsulateMessage(eapPacket);
@@ -320,7 +319,7 @@
private void handleSupplicantPacket(InboundPacket inPacket) throws StateMachineException {
Ethernet ethPkt = inPacket.parsed();
// Where does it come from?
- MacAddress srcMAC = ethPkt.getSourceMAC();
+ MacAddress srcMac = ethPkt.getSourceMAC();
DeviceId deviceId = inPacket.receivedFrom().deviceId();
PortNumber portNumber = inPacket.receivedFrom().port();
@@ -340,10 +339,10 @@
//send an EAP Request/Identify to the supplicant
EAP eapPayload = new EAP(EAP.REQUEST, stateMachine.identifier(), EAP.ATTR_IDENTITY, null);
- Ethernet eth = buildEapolResponse(srcMAC, MacAddress.valueOf(nasMacAddress),
+ Ethernet eth = buildEapolResponse(srcMac, MacAddress.valueOf(nasMacAddress),
ethPkt.getVlanID(), EAPOL.EAPOL_PACKET,
eapPayload);
- stateMachine.setSupplicantAddress(srcMAC);
+ stateMachine.setSupplicantAddress(srcMac);
stateMachine.setVlanId(ethPkt.getVlanID());
sendPacketToSupplicant(eth, stateMachine.supplicantConnectpoint());
@@ -362,9 +361,9 @@
stateMachine.setUsername(eapPacket.getData());
radiusPayload = getRadiusPayload(stateMachine, stateMachine.identifier(), eapPacket);
- radiusPayload.addMessageAuthenticator(AAA.this.radiusSecret);
+ radiusPayload.addMessageAuthenticator(AaaManager.this.radiusSecret);
- sendRADIUSPacket(radiusPayload);
+ sendRadiusPacket(radiusPayload);
// change the state to "PENDING"
stateMachine.requestAccess();
@@ -382,8 +381,8 @@
radiusPayload.setAttribute(RADIUSAttribute.RADIUS_ATTR_STATE,
stateMachine.challengeState());
- radiusPayload.addMessageAuthenticator(AAA.this.radiusSecret);
- sendRADIUSPacket(radiusPayload);
+ radiusPayload.addMessageAuthenticator(AaaManager.this.radiusSecret);
+ sendRadiusPacket(radiusPayload);
}
break;
case EAP.ATTR_TLS:
@@ -391,11 +390,11 @@
radiusPayload = getRadiusPayload(stateMachine, stateMachine.identifier(), eapPacket);
radiusPayload.setAttribute(RADIUSAttribute.RADIUS_ATTR_STATE,
- stateMachine.challengeState());
+ stateMachine.challengeState());
stateMachine.setRequestAuthenticator(radiusPayload.generateAuthCode());
- radiusPayload.addMessageAuthenticator(AAA.this.radiusSecret);
- sendRADIUSPacket(radiusPayload);
+ radiusPayload.addMessageAuthenticator(AaaManager.this.radiusSecret);
+ sendRadiusPacket(radiusPayload);
if (stateMachine.state() != StateMachine.STATE_PENDING) {
stateMachine.requestAccess();
@@ -512,10 +511,10 @@
*
* @param cfg configuration object
*/
- private void reconfigureNetwork(AAAConfig cfg) {
- AAAConfig newCfg;
+ private void reconfigureNetwork(AaaConfig cfg) {
+ AaaConfig newCfg;
if (cfg == null) {
- newCfg = new AAAConfig();
+ newCfg = new AaaConfig();
} else {
newCfg = cfg;
}
@@ -540,8 +539,8 @@
if (newCfg.radiusPort() != -1) {
radiusPort = newCfg.radiusPort();
}
- if (newCfg.radiusServerUDPPort() != -1) {
- radiusServerPort = newCfg.radiusServerUDPPort();
+ if (newCfg.radiusServerUdpPort() != -1) {
+ radiusServerPort = newCfg.radiusServerUdpPort();
}
}
@@ -550,9 +549,9 @@
if ((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED) &&
- event.configClass().equals(AAAConfig.class)) {
+ event.configClass().equals(AaaConfig.class)) {
- AAAConfig cfg = netCfgService.getConfig(appId, AAAConfig.class);
+ AaaConfig cfg = netCfgService.getConfig(appId, AaaConfig.class);
reconfigureNetwork(cfg);
log.info("Reconfigured");
}
diff --git a/src/test/java/org/onosproject/aaa/AAAIntegrationTest.java b/src/test/java/org/onosproject/aaa/AaaIntegrationTest.java
similarity index 93%
rename from src/test/java/org/onosproject/aaa/AAAIntegrationTest.java
rename to src/test/java/org/onosproject/aaa/AaaIntegrationTest.java
index fb513ce..6d708fe 100644
--- a/src/test/java/org/onosproject/aaa/AAAIntegrationTest.java
+++ b/src/test/java/org/onosproject/aaa/AaaIntegrationTest.java
@@ -34,9 +34,9 @@
* server and sends live packets over the network to it.
*/
@Ignore ("This should not be run as part of the standard build")
-public class AAAIntegrationTest extends AAATestBase {
+public class AaaIntegrationTest extends AaaTestBase {
- private AAA aaa;
+ private AaaManager aaa;
/**
* Mocks the network config registry.
@@ -46,7 +46,7 @@
extends NetworkConfigRegistryAdapter {
@Override
public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
- return (C) new AAAConfig();
+ return (C) new AaaConfig();
}
}
@@ -55,7 +55,7 @@
*/
@Before
public void setUp() {
- aaa = new AAA();
+ aaa = new AaaManager();
aaa.netCfgService = new TestNetworkConfigRegistry();
aaa.coreService = new CoreServiceAdapter();
aaa.packetService = new MockPacketService();
@@ -136,9 +136,9 @@
Ethernet successRadiusPacket = fetchPacket(2);
assertThat(successRadiusPacket, notNullValue());
- EAPOL successEAPOL = (EAPOL) successRadiusPacket.getPayload();
- EAP successEAP = (EAP) successEAPOL.getPayload();
- assertThat(successEAP.getCode(), is(EAP.SUCCESS));
+ EAPOL successEapol = (EAPOL) successRadiusPacket.getPayload();
+ EAP successEap = (EAP) successEapol.getPayload();
+ assertThat(successEap.getCode(), is(EAP.SUCCESS));
// State machine should be in authorized state
diff --git a/src/test/java/org/onosproject/aaa/AAATest.java b/src/test/java/org/onosproject/aaa/AaaManagerTest.java
similarity index 79%
rename from src/test/java/org/onosproject/aaa/AAATest.java
rename to src/test/java/org/onosproject/aaa/AaaManagerTest.java
index 860a7db..e3bcd9e 100644
--- a/src/test/java/org/onosproject/aaa/AAATest.java
+++ b/src/test/java/org/onosproject/aaa/AaaManagerTest.java
@@ -15,9 +15,7 @@
*/
package org.onosproject.aaa;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
+import com.google.common.base.Charsets;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -32,7 +30,8 @@
import org.onosproject.net.config.Config;
import org.onosproject.net.config.NetworkConfigRegistryAdapter;
-import com.google.common.base.Charsets;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
@@ -41,14 +40,14 @@
/**
* Set of tests of the ONOS application component.
*/
-public class AAATest extends AAATestBase {
+public class AaaManagerTest extends AaaTestBase {
static final String BAD_IP_ADDRESS = "198.51.100.0";
- private AAA aaa;
+ private AaaManager aaaManager;
- class AAAWithoutRadiusServer extends AAA {
- protected void sendRADIUSPacket(RADIUS radiusPacket) {
+ class AaaManagerWithoutRadiusServer extends AaaManager {
+ protected void sendRadiusPacket(RADIUS radiusPacket) {
savePacket(radiusPacket);
}
}
@@ -57,7 +56,7 @@
* Mocks the AAAConfig class to force usage of an unroutable address for the
* RADIUS server.
*/
- static class MockAAAConfig extends AAAConfig {
+ static class MockAaaConfig extends AaaConfig {
@Override
public InetAddress radiusIp() {
try {
@@ -77,7 +76,7 @@
extends NetworkConfigRegistryAdapter {
@Override
public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
- AAAConfig aaaConfig = new MockAAAConfig();
+ AaaConfig aaaConfig = new MockAaaConfig();
return (C) aaaConfig;
}
}
@@ -90,7 +89,7 @@
* @param challengeType type to use in challenge packet
* @return Ethernet packet
*/
- private RADIUS constructRADIUSCodeAccessChallengePacket(byte challengeCode, byte challengeType) {
+ private RADIUS constructRadiusCodeAccessChallengePacket(byte challengeCode, byte challengeType) {
String challenge = "12345678901234567";
@@ -116,11 +115,11 @@
*/
@Before
public void setUp() {
- aaa = new AAAWithoutRadiusServer();
- aaa.netCfgService = new TestNetworkConfigRegistry();
- aaa.coreService = new CoreServiceAdapter();
- aaa.packetService = new MockPacketService();
- aaa.activate();
+ aaaManager = new AaaManagerWithoutRadiusServer();
+ aaaManager.netCfgService = new TestNetworkConfigRegistry();
+ aaaManager.coreService = new CoreServiceAdapter();
+ aaaManager.packetService = new MockPacketService();
+ aaaManager.activate();
}
/**
@@ -128,7 +127,7 @@
*/
@After
public void tearDown() {
- aaa.deactivate();
+ aaaManager.deactivate();
}
/**
@@ -138,7 +137,7 @@
* @throws DeserializationException if deserialization of the packet contents
* fails.
*/
- private void checkRADIUSPacketFromSupplicant(RADIUS radius)
+ private void checkRadiusPacketFromSupplicant(RADIUS radius)
throws DeserializationException {
assertThat(radius, notNullValue());
@@ -173,7 +172,7 @@
sendPacket(startPacket);
Ethernet responsePacket = (Ethernet) fetchPacket(0);
- checkRadiusPacket(aaa, responsePacket, EAP.ATTR_IDENTITY);
+ checkRadiusPacket(aaaManager, responsePacket, EAP.ATTR_IDENTITY);
// (2) Supplicant identify
@@ -182,7 +181,7 @@
RADIUS radiusIdentifyPacket = (RADIUS) fetchPacket(1);
- checkRADIUSPacketFromSupplicant(radiusIdentifyPacket);
+ checkRadiusPacketFromSupplicant(radiusIdentifyPacket);
assertThat(radiusIdentifyPacket.getCode(), is(RADIUS.RADIUS_CODE_ACCESS_REQUEST));
assertThat(new String(radiusIdentifyPacket.getAttribute(RADIUSAttribute.RADIUS_ATTR_USERNAME).getValue()),
@@ -192,7 +191,7 @@
IpAddress.valueOf(IpAddress.Version.INET,
radiusIdentifyPacket.getAttribute(RADIUSAttribute.RADIUS_ATTR_NAS_IP)
.getValue());
- assertThat(nasIp.toString(), is(aaa.nasIpAddress.getHostAddress()));
+ assertThat(nasIp.toString(), is(aaaManager.nasIpAddress.getHostAddress()));
// State machine should have been created by now
@@ -204,11 +203,11 @@
// (3) RADIUS MD5 challenge
RADIUS radiusCodeAccessChallengePacket =
- constructRADIUSCodeAccessChallengePacket(RADIUS.RADIUS_CODE_ACCESS_CHALLENGE, EAP.ATTR_MD5);
- aaa.radiusListener.handleRadiusPacket(radiusCodeAccessChallengePacket);
+ constructRadiusCodeAccessChallengePacket(RADIUS.RADIUS_CODE_ACCESS_CHALLENGE, EAP.ATTR_MD5);
+ aaaManager.radiusListener.handleRadiusPacket(radiusCodeAccessChallengePacket);
Ethernet radiusChallengeMD5Packet = (Ethernet) fetchPacket(2);
- checkRadiusPacket(aaa, radiusChallengeMD5Packet, EAP.ATTR_MD5);
+ checkRadiusPacket(aaaManager, radiusChallengeMD5Packet, EAP.ATTR_MD5);
// (4) Supplicant MD5 response
@@ -221,7 +220,7 @@
RADIUS responseMd5RadiusPacket = (RADIUS) fetchPacket(3);
- checkRADIUSPacketFromSupplicant(responseMd5RadiusPacket);
+ checkRadiusPacketFromSupplicant(responseMd5RadiusPacket);
assertThat(responseMd5RadiusPacket.getIdentifier(), is((byte) 0));
assertThat(responseMd5RadiusPacket.getCode(), is(RADIUS.RADIUS_CODE_ACCESS_REQUEST));
@@ -233,11 +232,11 @@
// (5) RADIUS Success
RADIUS successPacket =
- constructRADIUSCodeAccessChallengePacket(RADIUS.RADIUS_CODE_ACCESS_ACCEPT, EAP.SUCCESS);
- aaa.radiusListener.handleRadiusPacket((successPacket));
+ constructRadiusCodeAccessChallengePacket(RADIUS.RADIUS_CODE_ACCESS_ACCEPT, EAP.SUCCESS);
+ aaaManager.radiusListener.handleRadiusPacket((successPacket));
Ethernet supplicantSuccessPacket = (Ethernet) fetchPacket(4);
- checkRadiusPacket(aaa, supplicantSuccessPacket, EAP.SUCCESS);
+ checkRadiusPacket(aaaManager, supplicantSuccessPacket, EAP.SUCCESS);
// State machine should be in authorized state
@@ -251,9 +250,9 @@
*/
@Test
public void testConfig() {
- assertThat(aaa.nasIpAddress.getHostAddress(), is(AAAConfig.DEFAULT_NAS_IP));
- assertThat(aaa.nasMacAddress, is(AAAConfig.DEFAULT_NAS_MAC));
- assertThat(aaa.radiusIpAddress.getHostAddress(), is(BAD_IP_ADDRESS));
- assertThat(aaa.radiusMacAddress, is(AAAConfig.DEFAULT_RADIUS_MAC));
+ assertThat(aaaManager.nasIpAddress.getHostAddress(), is(AaaConfig.DEFAULT_NAS_IP));
+ assertThat(aaaManager.nasMacAddress, is(AaaConfig.DEFAULT_NAS_MAC));
+ assertThat(aaaManager.radiusIpAddress.getHostAddress(), is(BAD_IP_ADDRESS));
+ assertThat(aaaManager.radiusMacAddress, is(AaaConfig.DEFAULT_RADIUS_MAC));
}
}
diff --git a/src/test/java/org/onosproject/aaa/AAATestBase.java b/src/test/java/org/onosproject/aaa/AaaTestBase.java
similarity index 97%
rename from src/test/java/org/onosproject/aaa/AAATestBase.java
rename to src/test/java/org/onosproject/aaa/AaaTestBase.java
index dffcba2..b076a2e 100644
--- a/src/test/java/org/onosproject/aaa/AAATestBase.java
+++ b/src/test/java/org/onosproject/aaa/AaaTestBase.java
@@ -15,11 +15,6 @@
*/
package org.onosproject.aaa;
-import java.nio.ByteBuffer;
-import java.security.MessageDigest;
-import java.util.LinkedList;
-import java.util.List;
-
import org.onlab.packet.BasePacket;
import org.onlab.packet.EAP;
import org.onlab.packet.EAPOL;
@@ -34,6 +29,11 @@
import org.onosproject.net.packet.PacketProcessor;
import org.onosproject.net.packet.PacketServiceAdapter;
+import java.nio.ByteBuffer;
+import java.security.MessageDigest;
+import java.util.LinkedList;
+import java.util.List;
+
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
@@ -44,7 +44,7 @@
/**
* Common methods for AAA app testing.
*/
-public class AAATestBase {
+public class AaaTestBase {
MacAddress clientMac = MacAddress.valueOf("1a:1a:1a:1a:1a:1a");
MacAddress serverMac = MacAddress.valueOf("2a:2a:2a:2a:2a:2a");
@@ -204,10 +204,10 @@
* @param radiusPacket packet to check
* @param code expected code
*/
- void checkRadiusPacket(AAA aaa, Ethernet radiusPacket, byte code) {
+ void checkRadiusPacket(AaaManager aaaManager, Ethernet radiusPacket, byte code) {
assertThat(radiusPacket.getSourceMAC(),
- is(MacAddress.valueOf(aaa.nasMacAddress)));
+ is(MacAddress.valueOf(aaaManager.nasMacAddress)));
assertThat(radiusPacket.getDestinationMAC(), is(serverMac));
assertThat(radiusPacket.getPayload(), instanceOf(EAPOL.class));