Jonathan Hart
Committed by Gerrit Code Review

Addressed some more naming issues throughout the code.

Change-Id: Id679540d55075d902283ad0e2e836b6517752784
......@@ -109,7 +109,7 @@ public class DhcpManager implements DhcpService {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PacketService packetService;
private DHCPPacketProcessor processor = new DHCPPacketProcessor();
private DhcpPacketProcessor processor = new DhcpPacketProcessor();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
......@@ -259,7 +259,7 @@ public class DhcpManager implements DhcpService {
return dhcpStore.getAvailableIPs();
}
private class DHCPPacketProcessor implements PacketProcessor {
private class DhcpPacketProcessor implements PacketProcessor {
/**
* Builds the DHCP Reply packet.
......@@ -437,7 +437,7 @@ public class DhcpManager implements DhcpService {
* @param context context of the incoming message
* @param dhcpPayload the extracted DHCP payload
*/
private void processDHCPPacket(PacketContext context, DHCP dhcpPayload) {
private void processDhcpPacket(PacketContext context, DHCP dhcpPayload) {
Ethernet packet = context.inPacket().parsed();
boolean flagIfRequestedIP = false;
boolean flagIfServerIP = false;
......@@ -464,9 +464,9 @@ public class DhcpManager implements DhcpService {
}
}
DHCPPacketType outgoingPacketType;
MacAddress clientMAC = new MacAddress(dhcpPayload.getClientHardwareAddress());
MacAddress clientMac = new MacAddress(dhcpPayload.getClientHardwareAddress());
VlanId vlanId = VlanId.vlanId(packet.getVlanID());
HostId hostId = HostId.hostId(clientMAC, vlanId);
HostId hostId = HostId.hostId(clientMac, vlanId);
if (incomingPacketType.getValue() == DHCPPacketType.DHCPDISCOVER.getValue()) {
......@@ -484,7 +484,7 @@ public class DhcpManager implements DhcpService {
if (flagIfServerIP && flagIfRequestedIP) {
// SELECTING state
if (dhcpStore.getIpAssignmentFromAllocationMap(HostId.hostId(clientMAC))
if (dhcpStore.getIpAssignmentFromAllocationMap(HostId.hostId(clientMac))
.fromOpenStack()) {
outgoingPacketType = DHCPPacketType.DHCPACK;
Ethernet ethReply = buildReply(packet, requestedIP, (byte) outgoingPacketType.getValue());
......@@ -544,7 +544,7 @@ public class DhcpManager implements DhcpService {
* @param context context of the incoming message
* @param packet the ethernet payload
*/
private void processARPPacket(PacketContext context, Ethernet packet) {
private void processArpPacket(PacketContext context, Ethernet packet) {
ARP arpPacket = (ARP) packet.getPayload();
......@@ -605,7 +605,7 @@ public class DhcpManager implements DhcpService {
// This is meant for the dhcp server so process the packet here.
DHCP dhcpPayload = (DHCP) udpPacket.getPayload();
processDHCPPacket(context, dhcpPayload);
processDhcpPacket(context, dhcpPayload);
}
}
} else if (packet.getEtherType() == Ethernet.TYPE_ARP) {
......@@ -614,7 +614,7 @@ public class DhcpManager implements DhcpService {
if ((arpPacket.getOpCode() == ARP.OP_REQUEST) &&
Objects.equals(myIP, Ip4Address.valueOf(arpPacket.getTargetProtocolAddress()))) {
processARPPacket(context, packet);
processArpPacket(context, packet);
}
}
......
......@@ -42,7 +42,7 @@ import java.util.Map;
* Manage DHCP address assignments.
*/
@Path("dhcp")
public class DHCPWebResource extends AbstractWebResource {
public class DhcpWebResource extends AbstractWebResource {
final DhcpService service = get(DhcpService.class);
......
......@@ -30,7 +30,7 @@
<init-param>
<param-name>com.sun.jersey.config.property.classnames</param-name>
<param-value>
org.onosproject.dhcp.rest.DHCPWebResource
org.onosproject.dhcp.rest.DhcpWebResource
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
......
......@@ -106,7 +106,7 @@ public class DhcpManagerTest {
*/
@Test
public void testDiscover() {
Ethernet reply = constructDHCPPacket(DHCPPacketType.DHCPDISCOVER);
Ethernet reply = constructDhcpPacket(DHCPPacketType.DHCPDISCOVER);
sendPacket(reply);
}
......@@ -115,7 +115,7 @@ public class DhcpManagerTest {
*/
@Test
public void testRequest() {
Ethernet reply = constructDHCPPacket(DHCPPacketType.DHCPREQUEST);
Ethernet reply = constructDhcpPacket(DHCPPacketType.DHCPREQUEST);
sendPacket(reply);
}
......@@ -138,7 +138,7 @@ public class DhcpManagerTest {
* @param packetType DHCP Message Type
* @return Ethernet packet
*/
private Ethernet constructDHCPPacket(DHCPPacketType packetType) {
private Ethernet constructDhcpPacket(DHCPPacketType packetType) {
// Ethernet Frame.
Ethernet ethReply = new Ethernet();
......
......@@ -120,7 +120,7 @@ public class OpenstackSwitchingRulePopulator {
*
* @param id device ID to set the rules
*/
private void setFlowRuleForDHCP(DeviceId id) {
private void setFlowRuleForDhcp(DeviceId id) {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
......
......@@ -462,10 +462,10 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner
private void initializePipeline() {
//processIpUnicastTable(true);
processACLTable(true);
processAclTable(true);
}
private void processACLTable(boolean install) {
private void processAclTable(boolean install) {
TrafficSelector.Builder selector;
TrafficTreatment.Builder treatment;
FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
......
......@@ -94,12 +94,12 @@ public class Controller {
protected String tsLocation;
protected char[] ksPwd;
protected char[] tsPwd;
protected SSLEngine serverSSLEngine;
protected SSLEngine serverSslEngine;
// Perf. related configuration
protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
private DriverService driverService;
private boolean enableOFTLS = TLS_DISABLED;
private boolean enableOfTls = TLS_DISABLED;
// ***************
// Getters/Setters
......@@ -132,7 +132,7 @@ public class Controller {
bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
ChannelPipelineFactory pfact =
new OpenflowPipelineFactory(this, null, serverSSLEngine);
new OpenflowPipelineFactory(this, null, serverSslEngine);
bootstrap.setPipelineFactory(pfact);
cg = new DefaultChannelGroup();
openFlowPorts.forEach(port -> {
......@@ -189,9 +189,9 @@ public class Controller {
this.systemStartTime = System.currentTimeMillis();
try {
getTLSParameters();
if (enableOFTLS) {
initSSL();
getTlsParameters();
if (enableOfTls) {
initSsl();
}
} catch (Exception ex) {
log.error("SSL init failed: {}", ex.getMessage());
......@@ -199,35 +199,35 @@ public class Controller {
}
private void getTLSParameters() {
private void getTlsParameters() {
String tempString = System.getProperty("enableOFTLS");
enableOFTLS = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
log.info("OpenFlow Security is {}", enableOFTLS ? "enabled" : "disabled");
if (enableOFTLS) {
enableOfTls = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
log.info("OpenFlow Security is {}", enableOfTls ? "enabled" : "disabled");
if (enableOfTls) {
ksLocation = System.getProperty("javax.net.ssl.keyStore");
if (Strings.isNullOrEmpty(ksLocation)) {
enableOFTLS = TLS_DISABLED;
enableOfTls = TLS_DISABLED;
return;
}
tsLocation = System.getProperty("javax.net.ssl.trustStore");
if (Strings.isNullOrEmpty(tsLocation)) {
enableOFTLS = TLS_DISABLED;
enableOfTls = TLS_DISABLED;
return;
}
ksPwd = System.getProperty("javax.net.ssl.keyStorePassword").toCharArray();
if (MIN_KS_LENGTH > ksPwd.length) {
enableOFTLS = TLS_DISABLED;
enableOfTls = TLS_DISABLED;
return;
}
tsPwd = System.getProperty("javax.net.ssl.trustStorePassword").toCharArray();
if (MIN_KS_LENGTH > tsPwd.length) {
enableOFTLS = TLS_DISABLED;
enableOfTls = TLS_DISABLED;
return;
}
}
}
private void initSSL() throws Exception {
private void initSsl() throws Exception {
TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
KeyStore ts = KeyStore.getInstance("JKS");
......@@ -242,13 +242,13 @@ public class Controller {
SSLContext serverContext = SSLContext.getInstance("TLS");
serverContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
serverSSLEngine = serverContext.createSSLEngine();
serverSslEngine = serverContext.createSSLEngine();
serverSSLEngine.setNeedClientAuth(true);
serverSSLEngine.setUseClientMode(false);
serverSSLEngine.setEnabledProtocols(serverSSLEngine.getSupportedProtocols());
serverSSLEngine.setEnabledCipherSuites(serverSSLEngine.getSupportedCipherSuites());
serverSSLEngine.setEnableSessionCreation(true);
serverSslEngine.setNeedClientAuth(true);
serverSslEngine.setUseClientMode(false);
serverSslEngine.setEnabledProtocols(serverSslEngine.getSupportedProtocols());
serverSslEngine.setEnabledCipherSuites(serverSslEngine.getSupportedCipherSuites());
serverSslEngine.setEnableSessionCreation(true);
}
// **************
......
......@@ -191,7 +191,7 @@ public class ControllerTest {
controller.setConfigParams(properties);
controller.start(null, new MockDriverService());
assertThat(controller.serverSSLEngine, notNullValue());
assertThat(controller.serverSslEngine, notNullValue());
controller.stop();
boolean removed = keystore.delete();
......
......@@ -196,16 +196,16 @@ public class HostLocationProviderTest {
providerService.clear();
// new host
testProcessor.process(new TestNAPacketContext(DEV4));
testProcessor.process(new TestNaPacketContext(DEV4));
assertNotNull("new host expected", providerService.added);
assertNull("host motion unexpected", providerService.moved);
// the host moved to new switch
testProcessor.process(new TestNAPacketContext(DEV5));
testProcessor.process(new TestNaPacketContext(DEV5));
assertNotNull("host motion expected", providerService.moved);
// the host was misheard on a spine
testProcessor.process(new TestNAPacketContext(DEV6));
testProcessor.process(new TestNaPacketContext(DEV6));
assertNull("host misheard on spine switch", providerService.spine);
}
......@@ -213,7 +213,7 @@ public class HostLocationProviderTest {
public void removeHostByDeviceRemove() {
provider.modified(CTX_FOR_REMOVE);
testProcessor.process(new TestArpPacketContext(DEV1));
testProcessor.process(new TestNAPacketContext(DEV4));
testProcessor.process(new TestNaPacketContext(DEV4));
Device device = new DefaultDevice(ProviderId.NONE, deviceId(DEV1), SWITCH,
"m", "h", "s", "n", new ChassisId(0L));
......@@ -292,8 +292,8 @@ public class HostLocationProviderTest {
* When receiving NeighborAdvertisement, updates location and IP.
*/
@Test
public void testReceiveNA() {
testProcessor.process(new TestNAPacketContext(DEV4));
public void testReceiveNa() {
testProcessor.process(new TestNaPacketContext(DEV4));
assertNotNull(providerService.added);
HostDescription descr = providerService.added;
assertThat(descr.location(), is(LOCATION2));
......@@ -306,8 +306,8 @@ public class HostLocationProviderTest {
* When receiving NeighborSolicitation, updates location and IP.
*/
@Test
public void testReceiveNS() {
testProcessor.process(new TestNSPacketContext(DEV4));
public void testReceiveNs() {
testProcessor.process(new TestNsPacketContext(DEV4));
HostDescription descr = providerService.added;
assertThat(descr.location(), is(LOCATION2));
assertThat(descr.hwAddress(), is(MAC2));
......@@ -319,7 +319,7 @@ public class HostLocationProviderTest {
* When receiving RouterAdvertisement, ignores it.
*/
@Test
public void testReceivesRA() {
public void testReceivesRa() {
testProcessor.process(new TestRAPacketContext(DEV4));
assertNull(providerService.added);
}
......@@ -328,7 +328,7 @@ public class HostLocationProviderTest {
* When receiving RouterSolicitation, ignores it.
*/
@Test
public void testReceiveRS() {
public void testReceiveRs() {
testProcessor.process(new TestRSPacketContext(DEV4));
assertNull(providerService.added);
}
......@@ -337,8 +337,8 @@ public class HostLocationProviderTest {
* When receiving Duplicate Address Detection (DAD), ignores it.
*/
@Test
public void testReceiveDAD() {
testProcessor.process(new TestDADPacketContext(DEV4));
public void testReceiveDad() {
testProcessor.process(new TestDadPacketContext(DEV4));
assertNull(providerService.added);
}
......@@ -575,10 +575,10 @@ public class HostLocationProviderTest {
/**
* Generates NeighborAdvertisement packet.
*/
private class TestNAPacketContext implements PacketContext {
private class TestNaPacketContext implements PacketContext {
private final String deviceId;
public TestNAPacketContext(String deviceId) {
public TestNaPacketContext(String deviceId) {
this.deviceId = deviceId;
}
......@@ -637,10 +637,10 @@ public class HostLocationProviderTest {
/**
* Generates NeighborSolicitation packet.
*/
private class TestNSPacketContext implements PacketContext {
private class TestNsPacketContext implements PacketContext {
private final String deviceId;
public TestNSPacketContext(String deviceId) {
public TestNsPacketContext(String deviceId) {
this.deviceId = deviceId;
}
......@@ -699,10 +699,10 @@ public class HostLocationProviderTest {
/**
* Generates Duplicate Address Detection packet.
*/
private class TestDADPacketContext implements PacketContext {
private class TestDadPacketContext implements PacketContext {
private final String deviceId;
public TestDADPacketContext(String deviceId) {
public TestDadPacketContext(String deviceId) {
this.deviceId = deviceId;
}
......
......@@ -58,7 +58,7 @@ interface DiscoveryContext {
*
* @return true to emit BDDP
*/
boolean useBDDP();
boolean useBddp();
/**
* Touches the link identified by the given key to indicate that it's active.
......
......@@ -155,7 +155,7 @@ class LinkDiscovery implements TimerTask {
* @param packetContext packet context
* @return true if handled
*/
boolean handleLLDP(PacketContext packetContext) {
boolean handleLldp(PacketContext packetContext) {
Ethernet eth = packetContext.inPacket().parsed();
if (eth == null) {
return false;
......@@ -216,7 +216,7 @@ class LinkDiscovery implements TimerTask {
* @param port the port
* @return Packet_out message with LLDP data
*/
private OutboundPacket createOutBoundLLDP(Long port) {
private OutboundPacket createOutBoundLldp(Long port) {
if (port == null) {
return null;
}
......@@ -233,7 +233,7 @@ class LinkDiscovery implements TimerTask {
* @param port the port
* @return Packet_out message with LLDP data
*/
private OutboundPacket createOutBoundBDDP(Long port) {
private OutboundPacket createOutBoundBddp(Long port) {
if (port == null) {
return null;
}
......@@ -246,10 +246,10 @@ class LinkDiscovery implements TimerTask {
private void sendProbes(Long portNumber) {
log.trace("Sending probes out to {}@{}", portNumber, device.id());
OutboundPacket pkt = createOutBoundLLDP(portNumber);
OutboundPacket pkt = createOutBoundLldp(portNumber);
context.packetService().emit(pkt);
if (context.useBDDP()) {
OutboundPacket bpkt = createOutBoundBDDP(portNumber);
if (context.useBddp()) {
OutboundPacket bpkt = createOutBoundBddp(portNumber);
context.packetService().emit(bpkt);
}
}
......
......@@ -81,7 +81,7 @@ import static org.slf4j.LoggerFactory.getLogger;
* Provider which uses LLDP and BDDP packets to detect network infrastructure links.
*/
@Component(immediate = true)
public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
public class LldpLinkProvider extends AbstractProvider implements LinkProvider {
private static final String PROVIDER_NAME = "org.onosproject.provider.lldp";
......@@ -138,7 +138,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
private static final String PROP_USE_BDDP = "useBDDP";
@Property(name = PROP_USE_BDDP, boolValue = true,
label = "Use BDDP for link discovery")
private boolean useBDDP = true;
private boolean useBddp = true;
private static final String PROP_PROBE_RATE = "probeRate";
private static final int DEFAULT_PROBE_RATE = 3_000;
......@@ -177,7 +177,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
/**
* Creates an OpenFlow link provider.
*/
public LLDPLinkProvider() {
public LldpLinkProvider() {
super(new ProviderId("lldp", PROVIDER_NAME));
}
......@@ -222,7 +222,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
} catch (NumberFormatException e) {
log.warn("Component configuration had invalid values", e);
newEnabled = enabled;
newUseBddp = useBDDP;
newUseBddp = useBddp;
newProbeRate = probeRate;
newStaleLinkAge = staleLinkAge;
newLldpSuppression = lldpSuppression;
......@@ -231,7 +231,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
boolean wasEnabled = enabled;
enabled = newEnabled;
useBDDP = newUseBddp;
useBddp = newUseBddp;
probeRate = newProbeRate;
staleLinkAge = newStaleLinkAge;
lldpSuppression = newLldpSuppression;
......@@ -250,7 +250,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
}
}
log.info(FORMAT, enabled, useBDDP, probeRate, staleLinkAge, lldpSuppression);
log.info(FORMAT, enabled, useBddp, probeRate, staleLinkAge, lldpSuppression);
}
/**
......@@ -418,7 +418,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId);
selector.matchEthType(TYPE_BSN);
if (useBDDP) {
if (useBddp) {
packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId);
} else {
packetService.cancelPackets(selector.build(), PacketPriority.CONTROL, appId);
......@@ -534,7 +534,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
return;
}
if (ld.handleLLDP(context)) {
if (ld.handleLldp(context)) {
context.block();
}
}
......@@ -624,8 +624,8 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
}
@Override
public boolean useBDDP() {
return useBDDP;
public boolean useBddp() {
return useBddp;
}
@Override
......
......@@ -72,7 +72,7 @@ import java.util.concurrent.CompletableFuture;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
public class LLDPLinkProviderTest {
public class LldpLinkProviderTest {
private static final DeviceId DID1 = DeviceId.deviceId("of:0000000000000001");
private static final DeviceId DID2 = DeviceId.deviceId("of:0000000000000002");
......@@ -83,7 +83,7 @@ public class LLDPLinkProviderTest {
private static Port pd3;
private static Port pd4;
private final LLDPLinkProvider provider = new LLDPLinkProvider();
private final LldpLinkProvider provider = new LldpLinkProvider();
private final TestLinkRegistry linkRegistry = new TestLinkRegistry();
private final TestLinkService linkService = new TestLinkService();
private final TestPacketService packetService = new TestPacketService();
......@@ -159,7 +159,7 @@ public class LLDPLinkProviderTest {
// update device in stub DeviceService with suppression config
deviceService.putDevice(device(DID3, DefaultAnnotations.builder()
.set(LLDPLinkProvider.NO_LLDP, "true")
.set(LldpLinkProvider.NO_LLDP, "true")
.build()));
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_UPDATED, DID3));
......@@ -207,7 +207,7 @@ public class LLDPLinkProviderTest {
// add device in stub DeviceService with suppression configured
deviceService.putDevice(device(DID3, DefaultAnnotations.builder()
.set(LLDPLinkProvider.NO_LLDP, "true")
.set(LldpLinkProvider.NO_LLDP, "true")
.build()));
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID3));
......@@ -249,7 +249,7 @@ public class LLDPLinkProviderTest {
final long portno3 = 3L;
final Port port3 = port(DID3, portno3, true,
DefaultAnnotations.builder()
.set(LLDPLinkProvider.NO_LLDP, "true")
.set(LldpLinkProvider.NO_LLDP, "true")
.build());
deviceService.putPorts(DID3, port3);
deviceListener.event(portEvent(DeviceEvent.Type.PORT_ADDED, DID3, port3));
......