Jonathan Hart

Fix naming convention issues in preparation for stricter checkstyle enforcement

Change-Id: I918b7b1dcf6424a526b6b26b89acc9a57d807fec
Showing 36 changed files with 228 additions and 233 deletions
......@@ -86,7 +86,7 @@ public final class AclRule {
/**
* Check if the first CIDR address is in (or the same as) the second CIDR address.
*/
private boolean checkCIDRinCIDR(Ip4Prefix cidrAddr1, Ip4Prefix cidrAddr2) {
private boolean checkCidrInCidr(Ip4Prefix cidrAddr1, Ip4Prefix cidrAddr2) {
if (cidrAddr2 == null) {
return true;
} else if (cidrAddr1 == null) {
......@@ -116,8 +116,8 @@ public final class AclRule {
public boolean checkMatch(AclRule r) {
return (this.dstTpPort == r.dstTpPort || r.dstTpPort == 0)
&& (this.ipProto == r.ipProto || r.ipProto == 0)
&& (checkCIDRinCIDR(this.srcIp(), r.srcIp()))
&& (checkCIDRinCIDR(this.dstIp(), r.dstIp()));
&& (checkCidrInCidr(this.srcIp(), r.srcIp()))
&& (checkCidrInCidr(this.dstIp(), r.dstIp()));
}
/**
......
......@@ -129,7 +129,7 @@ public class AclWebResource extends AbstractWebResource {
* @return 200 OK
*/
@DELETE
public Response clearACL() {
public Response clearAcl() {
get(AclService.class).clearAcl();
return Response.ok().build();
}
......@@ -189,4 +189,4 @@ public class AclWebResource extends AbstractWebResource {
return rule.build();
}
}
\ No newline at end of file
}
......
......@@ -90,7 +90,7 @@ public class AclManager implements AclService {
/**
* Checks if the given IP address is in the given CIDR address.
*/
private boolean checkIpInCIDR(Ip4Address ip, Ip4Prefix cidr) {
private boolean checkIpInCidr(Ip4Address ip, Ip4Prefix cidr) {
int offset = 32 - cidr.prefixLength();
int cidrPrefix = cidr.address().toInt();
int ipIntValue = ip.toInt();
......@@ -111,17 +111,17 @@ public class AclManager implements AclService {
DeviceId deviceId = event.subject().location().deviceId();
for (IpAddress address : event.subject().ipAddresses()) {
if ((rule.srcIp() != null) ?
(checkIpInCIDR(address.getIp4Address(), rule.srcIp())) :
(checkIpInCIDR(address.getIp4Address(), rule.dstIp()))) {
(checkIpInCidr(address.getIp4Address(), rule.srcIp())) :
(checkIpInCidr(address.getIp4Address(), rule.dstIp()))) {
if (!aclStore.checkIfRuleWorksInDevice(rule.id(), deviceId)) {
List<RuleId> allowingRuleList = aclStore
.getAllowingRuleByDenyingRule(rule.id());
if (allowingRuleList != null) {
for (RuleId allowingRuleId : allowingRuleList) {
generateACLFlow(aclStore.getAclRule(allowingRuleId), deviceId);
generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
}
}
generateACLFlow(rule, deviceId);
generateAclFlow(rule, deviceId);
}
}
}
......@@ -212,7 +212,7 @@ public class AclManager implements AclService {
if (cidrAddr.prefixLength() != 32) {
for (Host h : hosts) {
for (IpAddress a : h.ipAddresses()) {
if (checkIpInCIDR(a.getIp4Address(), cidrAddr)) {
if (checkIpInCidr(a.getIp4Address(), cidrAddr)) {
deviceIdSet.add(h.location().deviceId());
}
}
......@@ -220,7 +220,7 @@ public class AclManager implements AclService {
} else {
for (Host h : hosts) {
for (IpAddress a : h.ipAddresses()) {
if (checkIpInCIDR(a.getIp4Address(), cidrAddr)) {
if (checkIpInCidr(a.getIp4Address(), cidrAddr)) {
deviceIdSet.add(h.location().deviceId());
return deviceIdSet;
}
......@@ -245,10 +245,10 @@ public class AclManager implements AclService {
List<RuleId> allowingRuleList = aclStore.getAllowingRuleByDenyingRule(rule.id());
if (allowingRuleList != null) {
for (RuleId allowingRuleId : allowingRuleList) {
generateACLFlow(aclStore.getAclRule(allowingRuleId), deviceId);
generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
}
}
generateACLFlow(rule, deviceId);
generateAclFlow(rule, deviceId);
}
}
......@@ -256,7 +256,7 @@ public class AclManager implements AclService {
* Generates ACL flow rule according to ACL rule
* and install it into related device.
*/
private void generateACLFlow(AclRule rule, DeviceId deviceId) {
private void generateAclFlow(AclRule rule, DeviceId deviceId) {
if (rule == null || aclStore.checkIfRuleWorksInDevice(rule.id(), deviceId)) {
return;
}
......
......@@ -83,11 +83,11 @@ public class IcmpHandler {
if (((ICMP) ipv4.getPayload()).getIcmpType() == ICMP.TYPE_ECHO_REQUEST &&
ipMatches) {
sendICMPResponse(ethernet, connectPoint);
sendIcmpResponse(ethernet, connectPoint);
}
}
private void sendICMPResponse(Ethernet icmpRequest, ConnectPoint outport) {
private void sendIcmpResponse(Ethernet icmpRequest, ConnectPoint outport) {
Ethernet icmpReplyEth = new Ethernet();
......
......@@ -268,7 +268,7 @@ public class CordFabricManager implements FabricService {
removeVlan(vlan.vlan());
if (vlan.iptv()) {
provisionIPTV();
provisionIpTv();
}
vlan.ports().forEach(cp -> {
......@@ -283,7 +283,7 @@ public class CordFabricManager implements FabricService {
}
//FIXME: pass iptv vlan in here.
private void provisionIPTV() {
private void provisionIpTv() {
TrafficSelector ipTvUp = DefaultTrafficSelector.builder()
.matchVlanId(VlanId.vlanId((short) 7))
.matchInPort(PortNumber.portNumber(2))
......
......@@ -15,15 +15,12 @@
*/
package org.onosproject.optical.testapp;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.HashMap;
import java.util.Map;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MplsLabel;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.Device;
......@@ -39,15 +36,18 @@ import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleService;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MplsLabel;
import org.slf4j.Logger;
import java.util.HashMap;
import java.util.Map;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Sample reactive forwarding application.
*/
//@Component(immediate = true)
public class MPLSForwarding {
public class MplsForwarding {
private final Logger log = getLogger(getClass());
......
......@@ -22,7 +22,7 @@ import java.util.Optional;
/**
* Simple demo api interface.
*/
public interface DemoAPI {
public interface DemoApi {
enum InstallType { MESH, RANDOM }
......
......@@ -87,7 +87,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true)
@Service
public class DemoInstaller implements DemoAPI {
public class DemoInstaller implements DemoApi {
private final Logger log = getLogger(getClass());
......
......@@ -51,7 +51,7 @@ public class DemoResource extends BaseResource {
public Response flowTest(InputStream input) throws IOException {
ObjectMapper mapper = new ObjectMapper();
JsonNode cfg = mapper.readTree(input);
DemoAPI demo = get(DemoAPI.class);
DemoApi demo = get(DemoApi.class);
return Response.ok(demo.flowTest(Optional.ofNullable(cfg)).toString()).build();
}
......@@ -75,9 +75,9 @@ public class DemoResource extends BaseResource {
}
DemoAPI.InstallType type = DemoAPI.InstallType.valueOf(
DemoApi.InstallType type = DemoApi.InstallType.valueOf(
cfg.get("type").asText().toUpperCase());
DemoAPI demo = get(DemoAPI.class);
DemoApi demo = get(DemoApi.class);
demo.setup(type, Optional.ofNullable(cfg.get("runParams")));
return Response.ok(mapper.createObjectNode().toString()).build();
......@@ -93,7 +93,7 @@ public class DemoResource extends BaseResource {
@Produces(MediaType.APPLICATION_JSON)
public Response tearDown() {
ObjectMapper mapper = new ObjectMapper();
DemoAPI demo = get(DemoAPI.class);
DemoApi demo = get(DemoApi.class);
demo.tearDown();
return Response.ok(mapper.createObjectNode().toString()).build();
}
......
......@@ -15,12 +15,6 @@
*/
package org.onosproject.cli.net;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
import java.util.LinkedList;
import java.util.List;
import org.apache.karaf.shell.commands.Option;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
......@@ -47,6 +41,12 @@ import org.onosproject.net.intent.constraint.LinkTypeConstraint;
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.net.resource.link.BandwidthResource;
import java.util.LinkedList;
import java.util.List;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
/**
* Base class for command line operations for connectivity based intents.
*/
......@@ -99,11 +99,11 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
@Option(name = "--ndSLL", description = "IPv6 Neighbor Discovery Source Link-Layer",
required = false, multiValued = false)
private String ndSLLString = null;
private String ndSllString = null;
@Option(name = "--ndTLL", description = "IPv6 Neighbor Discovery Target Link-Layer",
required = false, multiValued = false)
private String ndTLLString = null;
private String ndTllString = null;
@Option(name = "--tcpSrc", description = "Source TCP Port",
required = false, multiValued = false)
......@@ -264,12 +264,12 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
selectorBuilder.matchIPv6NDTargetAddress(Ip6Address.valueOf(ndTargetString));
}
if (!isNullOrEmpty(ndSLLString)) {
selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSLLString));
if (!isNullOrEmpty(ndSllString)) {
selectorBuilder.matchIPv6NDSourceLinkLayerAddress(MacAddress.valueOf(ndSllString));
}
if (!isNullOrEmpty(ndTLLString)) {
selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTLLString));
if (!isNullOrEmpty(ndTllString)) {
selectorBuilder.matchIPv6NDTargetLinkLayerAddress(MacAddress.valueOf(ndTllString));
}
if (!isNullOrEmpty(srcTcpString)) {
......
......@@ -82,15 +82,15 @@ public class GetFlowStatistics extends AbstractShellCommand {
DeviceService deviceService = get(DeviceService.class);
FlowStatisticService flowStatsService = get(FlowStatisticService.class);
String deviceURI = getDeviceId(devicePort);
String portURI = getPortNumber(devicePort);
String deviceUri = getDeviceId(devicePort);
String portUri = getPortNumber(devicePort);
DeviceId ingressDeviceId = deviceId(deviceURI);
DeviceId ingressDeviceId = deviceId(deviceUri);
PortNumber ingressPortNumber;
if (portURI.length() == 0) {
if (portUri.length() == 0) {
ingressPortNumber = null;
} else {
ingressPortNumber = portNumber(portURI);
ingressPortNumber = portNumber(portUri);
}
Device device = deviceService.getDevice(ingressDeviceId);
......@@ -102,7 +102,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
if (ingressPortNumber != null) {
Port port = deviceService.getPort(ingressDeviceId, ingressPortNumber);
if (port == null) {
error("No such port %s on device %s", portURI, ingressDeviceId.uri());
error("No such port %s on device %s", portUri, ingressDeviceId.uri());
return;
}
}
......@@ -148,7 +148,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
// print show topn head line with type
print("deviceId=%s, show TOPN=%s flows, live type=%s, instruction type=%s",
deviceURI,
deviceUri,
Integer.toString(topn),
flowLiveType == null ? "ALL" : flowLiveType,
instructionType == null ? "ALL" : instructionType);
......@@ -169,7 +169,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
} else if (showAll) { // is true?
// print show all head line with type
print("deviceId=%s, show ALL flows, live type=%s, instruction type=%s",
deviceURI,
deviceUri,
flowLiveType == null ? "ALL" : flowLiveType,
instructionType == null ? "ALL" : instructionType);
if (ingressPortNumber == null) {
......@@ -188,7 +188,7 @@ public class GetFlowStatistics extends AbstractShellCommand {
}
} else { // if (showSummary == true) //always is true
// print show summary head line
print("deviceId=%s, show SUMMARY flows", deviceURI);
print("deviceId=%s, show SUMMARY flows", deviceUri);
if (ingressPortNumber == null) {
Map<ConnectPoint, SummaryFlowEntryWithLoad> summaryFlowLoadMap =
flowStatsService.loadSummary(device);
......
......@@ -15,24 +15,23 @@
*/
package org.onosproject.cli.net;
import java.util.Set;
import java.util.List;
import com.google.common.collect.Lists;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
import org.onosproject.net.intent.IntentId;
import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceAllocations;
import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.PathService;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Set;
/**
* Commands to test out LinkResourceManager directly.
......@@ -44,7 +43,7 @@ public class LinkResourceTestCommand extends AbstractShellCommand {
// default is bandwidth.
@Option(name = "-m", aliases = "--mpls", description = "MPLS resource",
required = false, multiValued = false)
private boolean isMPLS = false;
private boolean isMpls = false;
@Option(name = "-o", aliases = "--optical", description = "Optical resource",
required = false, multiValued = false)
......@@ -96,7 +95,7 @@ public class LinkResourceTestCommand extends AbstractShellCommand {
for (Path p : paths) {
List<Link> links = p.links();
LinkResourceRequest.Builder request = null;
if (isMPLS) {
if (isMpls) {
List<Link> nlinks = Lists.newArrayList();
try {
nlinks.addAll(links.subList(1, links.size() - 2));
......
......@@ -71,7 +71,7 @@ public class DefaultDeviceDescription extends AbstractDescription
*/
public DefaultDeviceDescription(DeviceDescription base,
SparseAnnotations... annotations) {
this(base.deviceURI(), base.type(), base.manufacturer(),
this(base.deviceUri(), base.type(), base.manufacturer(),
base.hwVersion(), base.swVersion(), base.serialNumber(),
base.chassisId(), annotations);
}
......@@ -83,13 +83,13 @@ public class DefaultDeviceDescription extends AbstractDescription
* @param annotations Annotations to use.
*/
public DefaultDeviceDescription(DeviceDescription base, Type type, SparseAnnotations... annotations) {
this(base.deviceURI(), type, base.manufacturer(),
this(base.deviceUri(), type, base.manufacturer(),
base.hwVersion(), base.swVersion(), base.serialNumber(),
base.chassisId(), annotations);
}
@Override
public URI deviceURI() {
public URI deviceUri() {
return uri;
}
......
......@@ -33,7 +33,7 @@ public interface DeviceDescription extends Description {
*
* @return provider specific URI for the device
*/
URI deviceURI();
URI deviceUri();
/**
* Returns the type of the infrastructure device.
......
......@@ -41,7 +41,7 @@ public class DefaultDeviceDescriptionTest {
public void basics() {
DeviceDescription device =
new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID);
assertEquals("incorrect uri", DURI, device.deviceURI());
assertEquals("incorrect uri", DURI, device.deviceUri());
assertEquals("incorrect type", SWITCH, device.type());
assertEquals("incorrect manufacturer", MFR, device.manufacturer());
assertEquals("incorrect hw", HW, device.hwVersion());
......
......@@ -57,7 +57,7 @@ public class XmlDriverLoaderTest {
}
@Test(expected = IOException.class)
public void badXML() throws IOException {
public void badXml() throws IOException {
XmlDriverLoader loader = new XmlDriverLoader(getClass().getClassLoader());
loader.loadDrivers(getClass().getResourceAsStream("drivers.bad.xml"), null);
}
......@@ -77,4 +77,4 @@ public class XmlDriverLoaderTest {
driver.createBehaviour(new DefaultDriverData(driver, DEVICE_ID), TestBehaviour.class);
}
}
\ No newline at end of file
}
......
......@@ -115,19 +115,19 @@ public class DefaultCellComparatorTest {
}
@Test
public void swEpisodeII() {
public void swEpisodeIi() {
assertTrue("r2d2 c3po",
cmp.compare(SmallStarWars.R2D2, SmallStarWars.C3PO) > 0);
}
@Test
public void swEpisodeIII() {
public void swEpisodeIii() {
assertTrue("luke c3po",
cmp.compare(SmallStarWars.LUKE, SmallStarWars.C3PO) > 0);
}
@Test
public void swEpisodeIV() {
public void swEpisodeIv() {
assertTrue("c3po luke",
cmp.compare(SmallStarWars.C3PO, SmallStarWars.LUKE) < 0);
}
......@@ -139,7 +139,7 @@ public class DefaultCellComparatorTest {
}
@Test
public void swEpisodeVI() {
public void swEpisodeVi() {
assertTrue("r2d2 luke",
cmp.compare(SmallStarWars.R2D2, SmallStarWars.LUKE) < 0);
}
......
......@@ -26,10 +26,10 @@ import org.onlab.graph.DijkstraGraphSearch;
import org.onlab.graph.DisjointPathPair;
import org.onlab.graph.GraphPathSearch;
import org.onlab.graph.GraphPathSearch.Result;
import org.onlab.graph.SRLGGraphSearch;
import org.onlab.graph.SrlgGraphSearch;
import org.onlab.graph.SuurballeGraphSearch;
import org.onlab.graph.TarjanGraphSearch;
import org.onlab.graph.TarjanGraphSearch.SCCResult;
import org.onlab.graph.TarjanGraphSearch.SccResult;
import org.onosproject.net.AbstractModel;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultDisjointPath;
......@@ -83,7 +83,7 @@ public class DefaultTopology extends AbstractModel implements Topology {
private final TopologyGraph graph;
private final LinkWeight weight;
private final Supplier<SCCResult<TopologyVertex, TopologyEdge>> clusterResults;
private final Supplier<SccResult<TopologyVertex, TopologyEdge>> clusterResults;
private final Supplier<ImmutableMap<ClusterId, TopologyCluster>> clusters;
private final Supplier<ImmutableSet<ConnectPoint>> infrastructurePoints;
private final Supplier<ImmutableSetMultimap<ClusterId, ConnectPoint>> broadcastSets;
......@@ -385,7 +385,7 @@ public class DefaultTopology extends AbstractModel implements Topology {
return ImmutableSet.of();
}
SRLGGraphSearch<TopologyVertex, TopologyEdge> srlg = new SRLGGraphSearch<>(riskProfile);
SrlgGraphSearch<TopologyVertex, TopologyEdge> srlg = new SrlgGraphSearch<>(riskProfile);
GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
srlg.search(graph, srcV, dstV, weight, ALL_PATHS);
ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
......@@ -455,14 +455,14 @@ public class DefaultTopology extends AbstractModel implements Topology {
// Searches for SCC clusters in the network topology graph using Tarjan
// algorithm.
private SCCResult<TopologyVertex, TopologyEdge> searchForClusters() {
private SccResult<TopologyVertex, TopologyEdge> searchForClusters() {
return TARJAN.search(graph, new NoIndirectLinksWeight());
}
// Builds the topology clusters and returns the id-cluster bindings.
private ImmutableMap<ClusterId, TopologyCluster> buildTopologyClusters() {
ImmutableMap.Builder<ClusterId, TopologyCluster> clusterBuilder = ImmutableMap.builder();
SCCResult<TopologyVertex, TopologyEdge> results = clusterResults.get();
SccResult<TopologyVertex, TopologyEdge> results = clusterResults.get();
// Extract both vertexes and edges from the results; the lists form
// pairs along the same index.
......
......@@ -532,7 +532,7 @@ public class SimpleDeviceStore
checkArgument(!providerDescs.isEmpty(), "No Device descriptions supplied");
ProviderId primary = pickPrimaryPID(providerDescs);
ProviderId primary = pickPrimaryPid(providerDescs);
DeviceDescriptions desc = providerDescs.get(primary);
......@@ -575,7 +575,7 @@ public class SimpleDeviceStore
private Port composePort(Device device, PortNumber number,
Map<ProviderId, DeviceDescriptions> descsMap) {
ProviderId primary = pickPrimaryPID(descsMap);
ProviderId primary = pickPrimaryPid(descsMap);
DeviceDescriptions primDescs = descsMap.get(primary);
// if no primary, assume not enabled
// TODO: revisit this default port enabled/disabled behavior
......@@ -613,7 +613,7 @@ public class SimpleDeviceStore
/**
* @return primary ProviderID, or randomly chosen one if none exists
*/
private ProviderId pickPrimaryPID(Map<ProviderId, DeviceDescriptions> descsMap) {
private ProviderId pickPrimaryPid(Map<ProviderId, DeviceDescriptions> descsMap) {
ProviderId fallBackPrimary = null;
for (Entry<ProviderId, DeviceDescriptions> e : descsMap.entrySet()) {
if (!e.getKey().isAncillary()) {
......
......@@ -61,7 +61,7 @@ public final class BasicDeviceOperator implements ConfigOperator {
}
SparseAnnotations sa = combine(bdc, descr.annotations());
return new DefaultDeviceDescription(descr.deviceURI(), type, descr.manufacturer(),
return new DefaultDeviceDescription(descr.deviceUri(), type, descr.manufacturer(),
descr.hwVersion(), descr.swVersion(),
descr.serialNumber(), descr.chassisId(), sa);
}
......
......@@ -255,7 +255,7 @@ public class FlowStatisticManager implements FlowStatisticService {
Instruction.Type instType) {
checkPermission(STATISTIC_READ);
List<TypedFlowEntryWithLoad> retTFEL = new ArrayList<>();
List<TypedFlowEntryWithLoad> retTfel = new ArrayList<>();
Set<FlowEntry> currentStats;
Set<FlowEntry> previousStats;
......@@ -264,11 +264,11 @@ public class FlowStatisticManager implements FlowStatisticService {
synchronized (flowStatisticStore) {
currentStats = flowStatisticStore.getCurrentFlowStatistic(cp);
if (currentStats == null) {
return retTFEL;
return retTfel;
}
previousStats = flowStatisticStore.getPreviousFlowStatistic(cp);
if (previousStats == null) {
return retTFEL;
return retTfel;
}
// copy to local flow entry set
typedStatistics = new TypedStatistics(currentStats, previousStats);
......@@ -291,7 +291,7 @@ public class FlowStatisticManager implements FlowStatisticService {
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,
isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval());
if (fel.size() > 0) {
retTFEL.addAll(fel);
retTfel.addAll(fel);
}
}
......@@ -302,7 +302,7 @@ public class FlowStatisticManager implements FlowStatisticService {
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,
isAllInstType, instType, TypedFlowEntryWithLoad.shortPollInterval());
if (fel.size() > 0) {
retTFEL.addAll(fel);
retTfel.addAll(fel);
}
}
......@@ -313,7 +313,7 @@ public class FlowStatisticManager implements FlowStatisticService {
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,
isAllInstType, instType, TypedFlowEntryWithLoad.midPollInterval());
if (fel.size() > 0) {
retTFEL.addAll(fel);
retTfel.addAll(fel);
}
}
......@@ -324,7 +324,7 @@ public class FlowStatisticManager implements FlowStatisticService {
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,
isAllInstType, instType, TypedFlowEntryWithLoad.longPollInterval());
if (fel.size() > 0) {
retTFEL.addAll(fel);
retTfel.addAll(fel);
}
}
......@@ -335,11 +335,11 @@ public class FlowStatisticManager implements FlowStatisticService {
List<TypedFlowEntryWithLoad> fel = typedFlowEntryLoadByInstInternal(cp, currentMap, previousMap,
isAllInstType, instType, TypedFlowEntryWithLoad.avgPollInterval());
if (fel.size() > 0) {
retTFEL.addAll(fel);
retTfel.addAll(fel);
}
}
return retTFEL;
return retTfel;
}
private List<TypedFlowEntryWithLoad> typedFlowEntryLoadByInstInternal(ConnectPoint cp,
......
......@@ -495,15 +495,15 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(5));
assertEquals(1, packetService.packets.size());
Ethernet ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
MAC3, MAC4, IP3, IP4);
Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
MAC3, MAC4, IP3, IP4);
verifyPacketOut(ndpReply, getLocation(5), packetService.packets.get(0));
}
......@@ -556,9 +556,9 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(NUM_DEVICES));
......@@ -686,9 +686,9 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
proxyArp.reply(ndpRequest, getLocation(NUM_DEVICES));
......@@ -752,37 +752,37 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
ourFirstIp);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
ourFirstIp);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(1, packetService.packets.size());
Ethernet ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
firstMac,
MAC2,
ourFirstIp,
theirIp);
Ethernet ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
firstMac,
MAC2,
ourFirstIp,
theirIp);
verifyPacketOut(ndpReply, LOC1, packetService.packets.get(0));
// Test a request for the second address on that port
packetService.packets.clear();
ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
ourSecondIp);
ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC2,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
ourSecondIp);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(1, packetService.packets.size());
ndpReply = buildNDP(ICMP6.NEIGHBOR_ADVERTISEMENT,
secondMac,
MAC2,
ourSecondIp,
theirIp);
ndpReply = buildNdp(ICMP6.NEIGHBOR_ADVERTISEMENT,
secondMac,
MAC2,
ourSecondIp,
theirIp);
verifyPacketOut(ndpReply, LOC1, packetService.packets.get(0));
}
......@@ -819,21 +819,21 @@ public class ProxyArpManagerTest {
Ip6Address theirIp = Ip6Address.valueOf("1000::ffff");
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
Ip6Address.valueOf("3000::1"));
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
Ip6Address.valueOf("3000::1"));
proxyArp.reply(ndpRequest, LOC1);
assertEquals(0, packetService.packets.size());
// Request for a valid internal IP address but coming in an external port
packetService.packets.clear();
ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
IP3);
ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC1,
MacAddress.valueOf("33:33:ff:00:00:01"),
theirIp,
IP3);
proxyArp.reply(ndpRequest, LOC1);
assertEquals(0, packetService.packets.size());
}
......@@ -894,11 +894,11 @@ public class ProxyArpManagerTest {
// This is a request from something inside our network (like a BGP
// daemon) to an external host.
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
ourMac,
MacAddress.valueOf("33:33:ff:00:00:01"),
ourIp,
theirIp);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
ourMac,
MacAddress.valueOf("33:33:ff:00:00:01"),
ourIp,
theirIp);
proxyArp.reply(ndpRequest, getLocation(5));
assertEquals(1, packetService.packets.size());
......@@ -954,9 +954,9 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
proxyArp.forward(ndpRequest, LOC2);
......@@ -995,9 +995,9 @@ public class ProxyArpManagerTest {
replay(hostService);
replay(interfaceService);
Ethernet ndpRequest = buildNDP(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
Ethernet ndpRequest = buildNdp(ICMP6.NEIGHBOR_SOLICITATION,
MAC4, SOLICITED_MAC3,
IP4, IP3);
proxyArp.forward(ndpRequest, getLocation(NUM_DEVICES));
......@@ -1113,7 +1113,7 @@ public class ProxyArpManagerTest {
* @param dstIp destination IP address
* @return the NDP packet
*/
private Ethernet buildNDP(byte type, MacAddress srcMac, MacAddress dstMac,
private Ethernet buildNdp(byte type, MacAddress srcMac, MacAddress dstMac,
Ip6Address srcIp, Ip6Address dstIp) {
assertThat(type, anyOf(
is(ICMP6.NEIGHBOR_SOLICITATION),
......
......@@ -47,7 +47,7 @@ public class NettyMessagingManager extends NettyMessaging {
@Activate
public void activate() throws Exception {
ControllerNode localNode = clusterMetadataService.getLocalNode();
getTLSParameters();
getTlsParameters();
super.start(new Endpoint(localNode.ip(), localNode.tcpPort()));
log.info("Started");
}
......@@ -58,29 +58,29 @@ public class NettyMessagingManager extends NettyMessaging {
log.info("Stopped");
}
private void getTLSParameters() {
private void getTlsParameters() {
String tempString = System.getProperty("enableNettyTLS");
enableNettyTLS = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
log.info("enableNettyTLS = {}", enableNettyTLS);
if (enableNettyTLS) {
enableNettyTls = Strings.isNullOrEmpty(tempString) ? TLS_DISABLED : Boolean.parseBoolean(tempString);
log.info("enableNettyTLS = {}", enableNettyTls);
if (enableNettyTls) {
ksLocation = System.getProperty("javax.net.ssl.keyStore");
if (Strings.isNullOrEmpty(ksLocation)) {
enableNettyTLS = TLS_DISABLED;
enableNettyTls = TLS_DISABLED;
return;
}
tsLocation = System.getProperty("javax.net.ssl.trustStore");
if (Strings.isNullOrEmpty(tsLocation)) {
enableNettyTLS = TLS_DISABLED;
enableNettyTls = TLS_DISABLED;
return;
}
ksPwd = System.getProperty("javax.net.ssl.keyStorePassword").toCharArray();
if (MIN_KS_LENGTH > ksPwd.length) {
enableNettyTLS = TLS_DISABLED;
enableNettyTls = TLS_DISABLED;
return;
}
tsPwd = System.getProperty("javax.net.ssl.trustStorePassword").toCharArray();
if (MIN_KS_LENGTH > tsPwd.length) {
enableNettyTLS = TLS_DISABLED;
enableNettyTls = TLS_DISABLED;
return;
}
}
......
......@@ -1040,7 +1040,7 @@ public class GossipDeviceStore
checkArgument(!providerDescs.isEmpty(), "No device descriptions supplied");
ProviderId primary = pickPrimaryPID(providerDescs);
ProviderId primary = pickPrimaryPid(providerDescs);
DeviceDescriptions desc = providerDescs.get(primary);
......@@ -1103,7 +1103,7 @@ public class GossipDeviceStore
private Port composePort(Device device, PortNumber number,
Map<ProviderId, DeviceDescriptions> descsMap) {
ProviderId primary = pickPrimaryPID(descsMap);
ProviderId primary = pickPrimaryPid(descsMap);
DeviceDescriptions primDescs = descsMap.get(primary);
// if no primary, assume not enabled
boolean isEnabled = false;
......@@ -1149,7 +1149,7 @@ public class GossipDeviceStore
/**
* @return primary ProviderID, or randomly chosen one if none exists
*/
private ProviderId pickPrimaryPID(
private ProviderId pickPrimaryPid(
Map<ProviderId, DeviceDescriptions> providerDescs) {
ProviderId fallBackPrimary = null;
for (Entry<ProviderId, DeviceDescriptions> e : providerDescs.entrySet()) {
......@@ -1165,7 +1165,7 @@ public class GossipDeviceStore
private DeviceDescriptions getPrimaryDescriptions(
Map<ProviderId, DeviceDescriptions> providerDescs) {
ProviderId pid = pickPrimaryPID(providerDescs);
ProviderId pid = pickPrimaryPid(providerDescs);
return providerDescs.get(pid);
}
......
......@@ -232,7 +232,7 @@ public class GossipDeviceStoreTest {
if (expected == actual) {
return;
}
assertEquals(expected.deviceURI(), actual.deviceURI());
assertEquals(expected.deviceUri(), actual.deviceUri());
assertEquals(expected.hwVersion(), actual.hwVersion());
assertEquals(expected.manufacturer(), actual.manufacturer());
assertEquals(expected.serialNumber(), actual.serialNumber());
......@@ -247,7 +247,7 @@ public class GossipDeviceStoreTest {
if (expected == actual) {
return;
}
assertEquals(expected.deviceURI(), actual.deviceURI());
assertEquals(expected.deviceUri(), actual.deviceUri());
assertEquals(expected.hwVersion(), actual.hwVersion());
assertEquals(expected.manufacturer(), actual.manufacturer());
assertEquals(expected.serialNumber(), actual.serialNumber());
......
......@@ -438,7 +438,7 @@ public final class KryoNamespaces {
DefaultTableStatisticsEntry.class
)
.register(new DefaultApplicationIdSerializer(), DefaultApplicationId.class)
.register(new URISerializer(), URI.class)
.register(new UriSerializer(), URI.class)
.register(new NodeIdSerializer(), NodeId.class)
.register(new ProviderIdSerializer(), ProviderId.class)
.register(new DeviceIdSerializer(), DeviceId.class)
......
......@@ -15,22 +15,22 @@
*/
package org.onosproject.store.serializers;
import java.net.URI;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import java.net.URI;
/**
* Serializer for {@link URI}.
*/
public class URISerializer extends Serializer<URI> {
public class UriSerializer extends Serializer<URI> {
/**
* Creates {@link URI} serializer instance.
*/
public URISerializer() {
public UriSerializer() {
super(false);
}
......
......@@ -53,7 +53,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* while it sends *all* ports (both tap and WDM ports, i.e., OCh and OMS) in the experimenter port desc stats reply.
*
*/
public class OFOpticalSwitchImplLINC13
public class OfOpticalSwitchImplLinc13
extends AbstractOpenFlowSwitch implements OpenFlowOpticalSwitch {
private final AtomicBoolean driverHandshakeComplete = new AtomicBoolean(false);
......
......@@ -61,7 +61,7 @@
manufacturer="FlowForwarding.org" hwVersion="Unknown"
swVersion="LINC-OE OpenFlow Software Switch 1.1">
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
impl="org.onosproject.driver.handshaker.OFOpticalSwitchImplLINC13"/>
impl="org.onosproject.driver.handshaker.OfOpticalSwitchImplLinc13"/>
</driver>
<driver name="corsa"
manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1">
......
......@@ -31,7 +31,7 @@ import java.util.Random;
* if one path goes through an edge in risk group 1, the other path will go
* through no edges in risk group 1.
*/
public class SRLGGraphSearch<V extends Vertex, E extends Edge<V>>
public class SrlgGraphSearch<V extends Vertex, E extends Edge<V>>
extends AbstractGraphPathSearch<V, E> {
static final int ITERATIONS = 100;
......@@ -55,7 +55,7 @@ public class SRLGGraphSearch<V extends Vertex, E extends Edge<V>>
* @param groups the number of disjoint risk groups
* @param grouping map linking edges to integral group assignments
*/
public SRLGGraphSearch(int groups, Map<E, Integer> grouping) {
public SrlgGraphSearch(int groups, Map<E, Integer> grouping) {
numGroups = groups;
riskGrouping = grouping;
}
......@@ -67,7 +67,7 @@ public class SRLGGraphSearch<V extends Vertex, E extends Edge<V>>
* @param grouping map linking edges to object group assignments,
* with same-group status linked to equality
*/
public SRLGGraphSearch(Map<E, Object> grouping) {
public SrlgGraphSearch(Map<E, Object> grouping) {
if (grouping == null) {
useSuurballe = true;
return;
......
......@@ -42,8 +42,8 @@ public class TarjanGraphSearch<V extends Vertex, E extends Edge<V>>
* </p>
*/
@Override
public SCCResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) {
SCCResult<V, E> result = new SCCResult<>(graph);
public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) {
SccResult<V, E> result = new SccResult<>(graph);
for (V vertex : graph.getVertexes()) {
VertexData data = result.data(vertex);
if (data == null) {
......@@ -64,7 +64,7 @@ public class TarjanGraphSearch<V extends Vertex, E extends Edge<V>>
*/
private VertexData<V> connect(Graph<V, E> graph, V vertex,
EdgeWeight<V, E> weight,
SCCResult<V, E> result) {
SccResult<V, E> result) {
VertexData<V> data = result.addData(vertex);
// Scan through all egress edges of the current vertex.
......@@ -99,7 +99,7 @@ public class TarjanGraphSearch<V extends Vertex, E extends Edge<V>>
/**
* Graph search result augmented with SCC vertexData.
*/
public static final class SCCResult<V extends Vertex, E extends Edge<V>>
public static final class SccResult<V extends Vertex, E extends Edge<V>>
implements Result {
private final Graph<V, E> graph;
......@@ -110,7 +110,7 @@ public class TarjanGraphSearch<V extends Vertex, E extends Edge<V>>
private final Map<V, VertexData<V>> vertexData = new HashMap<>();
private final List<VertexData<V>> visited = new ArrayList<>();
private SCCResult(Graph<V, E> graph) {
private SccResult(Graph<V, E> graph) {
this.graph = graph;
}
......@@ -189,7 +189,7 @@ public class TarjanGraphSearch<V extends Vertex, E extends Edge<V>>
return Collections.unmodifiableSet(edges);
}
public SCCResult<V, E> build() {
public SccResult<V, E> build() {
clusterVertexes = Collections.unmodifiableList(clusterVertexes);
clusterEdges = Collections.unmodifiableList(clusterEdges);
return this;
......
......@@ -31,11 +31,11 @@ import static org.onlab.graph.GraphPathSearch.ALL_PATHS;
/**
* Test of the Suurballe backup path algorithm.
*/
public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
public class SrlgGraphSearchTest extends BreadthFirstSearchTest {
@Override
protected AbstractGraphPathSearch<TestVertex, TestEdge> graphSearch() {
return new SRLGGraphSearch<>(null);
return new SrlgGraphSearch<>(null);
}
public void setDefaultWeights() {
......@@ -64,7 +64,7 @@ public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 1);
SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, C, weight, ALL_PATHS).paths();
System.out.println("\n\n\n" + paths + "\n\n\n");
assertEquals("one disjoint path pair found", 1, paths.size());
......@@ -105,7 +105,7 @@ public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
riskProfile.put(dC, 1);
riskProfile.put(cE, 2);
riskProfile.put(bE, 3);
SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(4, riskProfile);
SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(4, riskProfile);
search.search(graph, A, E, weight, ALL_PATHS).paths();
}
......@@ -127,7 +127,7 @@ public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
riskProfile.put(dE, 3);
riskProfile.put(aC, 4);
riskProfile.put(cE, 5);
SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(6, riskProfile);
SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(6, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, E, weight, ALL_PATHS).paths();
assertTrue("> one disjoint path pair found", paths.size() >= 1);
checkIsDisjoint(paths.iterator().next(), riskProfile);
......@@ -147,7 +147,7 @@ public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 0);
SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, C, weight, ALL_PATHS).paths();
System.out.println(paths);
assertTrue("no disjoint path pairs found", paths.size() == 0);
......@@ -167,7 +167,7 @@ public class SRLGGraphSearchTest extends BreadthFirstSearchTest {
riskProfile.put(bC, 0);
riskProfile.put(aD, 1);
riskProfile.put(dC, 0);
SRLGGraphSearch<TestVertex, TestEdge> search = new SRLGGraphSearch<>(2, riskProfile);
SrlgGraphSearch<TestVertex, TestEdge> search = new SrlgGraphSearch<>(2, riskProfile);
Set<Path<TestVertex, TestEdge>> paths = search.search(graph, A, E, weight, ALL_PATHS).paths();
assertTrue("no disjoint path pairs found", paths.size() == 0);
}
......
......@@ -19,20 +19,20 @@ import org.junit.Test;
import static com.google.common.collect.ImmutableSet.of;
import static org.junit.Assert.assertEquals;
import static org.onlab.graph.TarjanGraphSearch.SCCResult;
import static org.onlab.graph.TarjanGraphSearch.SccResult;
/**
* Tarjan graph search tests.
*/
public class TarjanGraphSearchTest extends GraphTest {
private void validate(SCCResult<TestVertex, TestEdge> result, int cc) {
private void validate(SccResult<TestVertex, TestEdge> result, int cc) {
System.out.println("Cluster count: " + result.clusterVertexes().size());
System.out.println("Clusters: " + result.clusterVertexes());
assertEquals("incorrect cluster count", cc, result.clusterCount());
}
private void validate(SCCResult<TestVertex, TestEdge> result,
private void validate(SccResult<TestVertex, TestEdge> result,
int i, int vc, int ec) {
assertEquals("incorrect cluster count", vc, result.clusterVertexes().get(i).size());
assertEquals("incorrect edge count", ec, result.clusterEdges().get(i).size());
......@@ -42,7 +42,7 @@ public class TarjanGraphSearchTest extends GraphTest {
public void basic() {
graph = new AdjacencyListsGraph<>(vertexes(), edges());
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 6);
}
......@@ -59,7 +59,7 @@ public class TarjanGraphSearchTest extends GraphTest {
new TestEdge(H, A, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 1);
validate(result, 0, 8, 8);
}
......@@ -76,7 +76,7 @@ public class TarjanGraphSearchTest extends GraphTest {
new TestEdge(G, H, 1),
new TestEdge(H, E, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
......@@ -95,7 +95,7 @@ public class TarjanGraphSearchTest extends GraphTest {
new TestEdge(H, E, 1),
new TestEdge(B, E, 1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
SCCResult<TestVertex, TestEdge> result = gs.search(graph, null);
SccResult<TestVertex, TestEdge> result = gs.search(graph, null);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
......@@ -116,7 +116,7 @@ public class TarjanGraphSearchTest extends GraphTest {
new TestEdge(E, B, -1)));
TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>();
SCCResult<TestVertex, TestEdge> result = gs.search(graph, weight);
SccResult<TestVertex, TestEdge> result = gs.search(graph, weight);
validate(result, 2);
validate(result, 0, 4, 4);
validate(result, 1, 4, 4);
......
......@@ -47,7 +47,7 @@ public class HexStringTest {
}
@Test
public void testToLongMSB() {
public void testToLongMsb() {
String dpidStr = "ca:7c:5e:d1:64:7a:95:9b";
long valid = -3856102927509056101L;
long testLong = HexString.toLong(dpidStr);
......
......@@ -15,6 +15,10 @@
*/
package org.onlab.netty;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalListener;
import com.google.common.cache.RemovalNotification;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
......@@ -34,11 +38,20 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import org.apache.commons.pool.KeyedPoolableObjectFactory;
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
import org.onosproject.store.cluster.messaging.Endpoint;
import org.onosproject.store.cluster.messaging.MessagingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.TrustManagerFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
......@@ -51,23 +64,6 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
import java.util.function.Function;
import org.apache.commons.pool.KeyedPoolableObjectFactory;
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
import org.onosproject.store.cluster.messaging.Endpoint;
import org.onosproject.store.cluster.messaging.MessagingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalListener;
import com.google.common.cache.RemovalNotification;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.TrustManagerFactory;
/**
* Implementation of MessagingService based on <a href="http://netty.io/">Netty</a> framework.
*/
......@@ -102,7 +98,7 @@ public class NettyMessaging implements MessagingService {
private Class<? extends Channel> clientChannelClass;
protected static final boolean TLS_DISABLED = false;
protected boolean enableNettyTLS = TLS_DISABLED;
protected boolean enableNettyTls = TLS_DISABLED;
protected String ksLocation;
protected String tsLocation;
......@@ -259,8 +255,8 @@ public class NettyMessaging implements MessagingService {
b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
b.group(serverGroup, clientGroup);
b.channel(serverChannelClass);
if (enableNettyTLS) {
b.childHandler(new SSLServerCommunicationChannelInitializer());
if (enableNettyTls) {
b.childHandler(new SslServerCommunicationChannelInitializer());
} else {
b.childHandler(new OnosCommunicationChannelInitializer());
}
......@@ -303,8 +299,8 @@ public class NettyMessaging implements MessagingService {
// http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#37.0
bootstrap.channel(clientChannelClass);
bootstrap.option(ChannelOption.SO_KEEPALIVE, true);
if (enableNettyTLS) {
bootstrap.handler(new SSLClientCommunicationChannelInitializer());
if (enableNettyTls) {
bootstrap.handler(new SslClientCommunicationChannelInitializer());
} else {
bootstrap.handler(new OnosCommunicationChannelInitializer());
}
......@@ -325,7 +321,7 @@ public class NettyMessaging implements MessagingService {
}
}
private class SSLServerCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private class SslServerCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private final ChannelHandler dispatcher = new InboundMessageDispatcher();
private final ChannelHandler encoder = new MessageEncoder();
......@@ -345,15 +341,15 @@ public class NettyMessaging implements MessagingService {
SSLContext serverContext = SSLContext.getInstance("TLS");
serverContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
SSLEngine serverSSLEngine = serverContext.createSSLEngine();
SSLEngine 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);
channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(serverSSLEngine))
channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(serverSslEngine))
.addLast("encoder", encoder)
.addLast("decoder", new MessageDecoder())
.addLast("handler", dispatcher);
......@@ -361,7 +357,7 @@ public class NettyMessaging implements MessagingService {
}
private class SSLClientCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private class SslClientCommunicationChannelInitializer extends ChannelInitializer<SocketChannel> {
private final ChannelHandler dispatcher = new InboundMessageDispatcher();
private final ChannelHandler encoder = new MessageEncoder();
......@@ -381,14 +377,14 @@ public class NettyMessaging implements MessagingService {
SSLContext clientContext = SSLContext.getInstance("TLS");
clientContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
SSLEngine clientSSLEngine = clientContext.createSSLEngine();
SSLEngine clientSslEngine = clientContext.createSSLEngine();
clientSSLEngine.setUseClientMode(true);
clientSSLEngine.setEnabledProtocols(clientSSLEngine.getSupportedProtocols());
clientSSLEngine.setEnabledCipherSuites(clientSSLEngine.getSupportedCipherSuites());
clientSSLEngine.setEnableSessionCreation(true);
clientSslEngine.setUseClientMode(true);
clientSslEngine.setEnabledProtocols(clientSslEngine.getSupportedProtocols());
clientSslEngine.setEnabledCipherSuites(clientSslEngine.getSupportedCipherSuites());
clientSslEngine.setEnableSessionCreation(true);
channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(clientSSLEngine))
channel.pipeline().addLast("ssl", new io.netty.handler.ssl.SslHandler(clientSslEngine))
.addLast("encoder", encoder)
.addLast("decoder", new MessageDecoder())
.addLast("handler", dispatcher);
......
......@@ -327,7 +327,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
String value = annotations.value("optical.waves").trim();
try {
int numChls = Integer.parseInt(value);
updateOMSPorts(numChls, src, dst);
updateOmsPorts(numChls, src, dst);
} catch (NumberFormatException e) {
log.warn("Invalid channel ({}), can't configure port(s)", value);
return;
......@@ -373,7 +373,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
}
}
private void updateOMSPorts(int numChls, ConnectPoint srcCp, ConnectPoint dstCp) {
private void updateOmsPorts(int numChls, ConnectPoint srcCp, ConnectPoint dstCp) {
// round down to largest slot that allows numChl channels to fit into C band range
ChannelSpacing chl = null;
Frequency perChl = TOTAL.floorDivision(numChls);
......