Jonathan Hart
Committed by Gerrit Code Review

Follow ONOS naming convention in PIM application

Change-Id: Id553a89630b44eafc791e54e54b043fb4182e324
......@@ -18,8 +18,8 @@ package org.onosproject.pim.cli;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.pim.impl.PIMInterface;
import org.onosproject.pim.impl.PIMInterfaceService;
import org.onosproject.pim.impl.PimInterface;
import org.onosproject.pim.impl.PimInterfaceService;
import java.util.Set;
......@@ -35,9 +35,9 @@ public class PimInterfacesListCommand extends AbstractShellCommand {
@Override
protected void execute() {
PIMInterfaceService interfaceService = get(PIMInterfaceService.class);
PimInterfaceService interfaceService = get(PimInterfaceService.class);
Set<PIMInterface> interfaces = interfaceService.getPimInterfaces();
Set<PimInterface> interfaces = interfaceService.getPimInterfaces();
interfaces.forEach(pimIntf -> {
print(FORMAT, pimIntf.getInterface().name(),
......
......@@ -19,9 +19,9 @@ package org.onosproject.pim.cli;
import org.apache.karaf.shell.commands.Command;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.pim.impl.PIMInterface;
import org.onosproject.pim.impl.PIMInterfaceService;
import org.onosproject.pim.impl.PIMNeighbor;
import org.onosproject.pim.impl.PimInterface;
import org.onosproject.pim.impl.PimInterfaceService;
import org.onosproject.pim.impl.PimNeighbor;
import java.util.Set;
......@@ -37,13 +37,13 @@ public class PimNeighborsListCommand extends AbstractShellCommand {
@Override
protected void execute() {
PIMInterfaceService interfaceService = get(PIMInterfaceService.class);
PimInterfaceService interfaceService = get(PimInterfaceService.class);
Set<PIMInterface> interfaces = interfaceService.getPimInterfaces();
Set<PimInterface> interfaces = interfaceService.getPimInterfaces();
for (PIMInterface intf : interfaces) {
for (PimInterface intf : interfaces) {
print(INTF_FORMAT, intf.getInterface().name(), intf.getIpAddress());
for (PIMNeighbor neighbor : intf.getNeighbors()) {
for (PimNeighbor neighbor : intf.getNeighbors()) {
// Filter out the PIM neighbor representing 'us'
if (!neighbor.ipAddress().equals(intf.getIpAddress())) {
print(NEIGHBOR_FORMAT, neighbor.ipAddress(),
......
......@@ -42,7 +42,7 @@ import static org.slf4j.LoggerFactory.getLogger;
* The main PIM controller class.
*/
@Component(immediate = true)
public class PIMApplication {
public class PimApplication {
private final Logger log = getLogger(getClass());
// Used to get the appId
......@@ -61,13 +61,13 @@ public class PIMApplication {
protected MulticastRouteService ms;
// Create an instance of the PIM packet handler
protected PIMPacketHandler pimPacketHandler;
protected PimPacketHandler pimPacketHandler;
// Provide interfaces to the pimInterface manager as a result of Netconfig updates.
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected PIMInterfaceService pimInterfaceManager;
protected PimInterfaceService pimInterfaceManager;
private final PIMPacketProcessor processor = new PIMPacketProcessor();
private final PimPacketProcessor processor = new PimPacketProcessor();
/**
* Activate the PIM component.
......@@ -89,7 +89,7 @@ public class PIMApplication {
appId, Optional.empty());
// Get a copy of the PIM Packet Handler
pimPacketHandler = new PIMPacketHandler();
pimPacketHandler = new PimPacketHandler();
log.info("Started");
}
......@@ -108,7 +108,7 @@ public class PIMApplication {
* The class that will receive PIM packets, sanitize them, determine the PIMInterface
* they arrived on, then forward them on to be processed by the appropriate entity.
*/
public class PIMPacketProcessor implements PacketProcessor {
public class PimPacketProcessor implements PacketProcessor {
@Override
public void process(PacketContext context) {
......@@ -135,7 +135,7 @@ public class PIMApplication {
}
// Get the PIM Interface the packet was received on.
PIMInterface pimi = pimInterfaceManager.getPIMInterface(pkt.receivedFrom());
PimInterface pimi = pimInterfaceManager.getPimInterface(pkt.receivedFrom());
if (pimi == null) {
return;
}
......
......@@ -55,7 +55,7 @@ import static org.slf4j.LoggerFactory.getLogger;
* PIM Interface represents an ONOS Interface with IP and MAC addresses for
* a given ConnectPoint.
*/
public final class PIMInterface {
public final class PimInterface {
private final Logger log = getLogger(getClass());
......@@ -87,7 +87,7 @@ public final class PIMInterface {
private IpAddress drIpaddress;
// A map of all our PIM neighbors keyed on our neighbors IP address
private Map<IpAddress, PIMNeighbor> pimNeighbors = new ConcurrentHashMap<>();
private Map<IpAddress, PimNeighbor> pimNeighbors = new ConcurrentHashMap<>();
private Map<McastRoute, RouteData> routes = new ConcurrentHashMap<>();
......@@ -101,7 +101,7 @@ public final class PIMInterface {
* @param overrideInterval override interval
* @param packetService reference to the packet service
*/
private PIMInterface(Interface intf,
private PimInterface(Interface intf,
int helloInterval,
short holdTime,
int priority,
......@@ -122,7 +122,7 @@ public final class PIMInterface {
generationId = new Random().nextInt();
// Create a PIM Neighbor to represent ourselves for DR election.
PIMNeighbor us = new PIMNeighbor(ourIp, mac, holdTime, 0, priority, generationId);
PimNeighbor us = new PimNeighbor(ourIp, mac, holdTime, 0, priority, generationId);
pimNeighbors.put(ourIp, us);
drIpaddress = ourIp;
......@@ -150,7 +150,7 @@ public final class PIMInterface {
* @param intf ONOS Interface
* @return PIM interface instance
*/
public PIMInterface setInterface(Interface intf) {
public PimInterface setInterface(Interface intf) {
onosInterface = intf;
return this;
}
......@@ -223,7 +223,7 @@ public final class PIMInterface {
*
* @return PIM neighbors
*/
public Collection<PIMNeighbor> getNeighbors() {
public Collection<PimNeighbor> getNeighbors() {
return ImmutableList.copyOf(pimNeighbors.values());
}
......@@ -236,13 +236,13 @@ public final class PIMInterface {
* state if they have.
*/
public void checkNeighborTimeouts() {
Set<PIMNeighbor> expired = pimNeighbors.values().stream()
Set<PimNeighbor> expired = pimNeighbors.values().stream()
// Don't time ourselves out!
.filter(neighbor -> !neighbor.ipAddress().equals(getIpAddress()))
.filter(neighbor -> neighbor.isExpired())
.collect(Collectors.toSet());
for (PIMNeighbor neighbor : expired) {
for (PimNeighbor neighbor : expired) {
log.info("Timing out neighbor {}", neighbor);
pimNeighbors.remove(neighbor.ipAddress(), neighbor);
}
......@@ -262,7 +262,7 @@ public final class PIMInterface {
lastHello = System.currentTimeMillis();
// Create the base PIM Packet and mark it a hello packet
PIMPacket pimPacket = new PIMPacket(PIM.TYPE_HELLO);
PimPacket pimPacket = new PimPacket(PIM.TYPE_HELLO);
// We need to set the source MAC and IPv4 addresses
pimPacket.setSrcMacAddr(onosInterface.mac());
......@@ -276,7 +276,7 @@ public final class PIMInterface {
hello.addOption(PIMHelloOption.createGenID(generationId));
// Now set the hello option payload
pimPacket.setPIMPayload(hello);
pimPacket.setPimPayload(hello);
packetService.emit(new DefaultOutboundPacket(
onosInterface.connectPoint().deviceId(),
......@@ -315,7 +315,7 @@ public final class PIMInterface {
}
// get the DR values for later calculation
PIMNeighbor dr = pimNeighbors.get(drIpaddress);
PimNeighbor dr = pimNeighbors.get(drIpaddress);
checkNotNull(dr);
IpAddress drip = drIpaddress;
......@@ -328,8 +328,8 @@ public final class PIMInterface {
PIMHello hello = (PIMHello) pimhdr.getPayload();
// Determine if we already have a PIMNeighbor
PIMNeighbor nbr = pimNeighbors.getOrDefault(srcip, null);
PIMNeighbor newNbr = PIMNeighbor.createPimNeighbor(srcip, nbrmac, hello.getOptions().values());
PimNeighbor nbr = pimNeighbors.getOrDefault(srcip, null);
PimNeighbor newNbr = PimNeighbor.createPimNeighbor(srcip, nbrmac, hello.getOptions().values());
if (nbr == null) {
pimNeighbors.putIfAbsent(srcip, newNbr);
......@@ -364,7 +364,7 @@ public final class PIMInterface {
}
// Run an election if we need to. Return the elected IP address.
private IpAddress election(PIMNeighbor nbr, IpAddress drIp, int drPriority) {
private IpAddress election(PimNeighbor nbr, IpAddress drIp, int drPriority) {
IpAddress nbrIp = nbr.ipAddress();
if (nbr.priority() > drPriority) {
......@@ -494,7 +494,7 @@ public final class PIMInterface {
public static class Builder {
private Interface intf;
private PacketService packetService;
private int helloInterval = PIMInterfaceManager.DEFAULT_HELLO_INTERVAL;
private int helloInterval = PimInterfaceManager.DEFAULT_HELLO_INTERVAL;
private short holdtime = PIMHelloOption.DEFAULT_HOLDTIME;
private int priority = PIMHelloOption.DEFAULT_PRIORITY;
private short propagationDelay = PIMHelloOption.DEFAULT_PRUNEDELAY;
......@@ -582,11 +582,11 @@ public final class PIMInterface {
*
* @return PIM interface
*/
public PIMInterface build() {
public PimInterface build() {
checkArgument(intf != null, "Must provide an interface");
checkArgument(packetService != null, "Must provide a packet service");
return new PIMInterface(intf, helloInterval, holdtime, priority,
return new PimInterface(intf, helloInterval, holdtime, priority,
propagationDelay, overrideInterval, packetService);
}
......
......@@ -62,7 +62,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component(immediate = true)
@Service
public class PIMInterfaceManager implements PIMInterfaceService {
public class PimInterfaceManager implements PimInterfaceService {
private final Logger log = getLogger(getClass());
......@@ -104,9 +104,9 @@ public class PIMInterfaceManager implements PIMInterfaceService {
protected RoutingService unicastRoutingService;
// Store PIM Interfaces in a map key'd by ConnectPoint
private final Map<ConnectPoint, PIMInterface> pimInterfaces = Maps.newConcurrentMap();
private final Map<ConnectPoint, PimInterface> pimInterfaces = Maps.newConcurrentMap();
private final Map<McastRoute, PIMInterface> routes = Maps.newConcurrentMap();
private final Map<McastRoute, PimInterface> routes = Maps.newConcurrentMap();
private final InternalNetworkConfigListener configListener =
new InternalNetworkConfigListener();
......@@ -147,18 +147,18 @@ public class PIMInterfaceManager implements PIMInterfaceService {
// Schedule the periodic hello sender.
scheduledExecutorService.scheduleAtFixedRate(
SafeRecurringTask.wrap(
() -> pimInterfaces.values().forEach(PIMInterface::sendHello)),
() -> pimInterfaces.values().forEach(PimInterface::sendHello)),
initialHelloDelay, pimHelloPeriod, TimeUnit.MILLISECONDS);
// Schedule task to periodically time out expired neighbors
scheduledExecutorService.scheduleAtFixedRate(
SafeRecurringTask.wrap(
() -> pimInterfaces.values().forEach(PIMInterface::checkNeighborTimeouts)),
() -> pimInterfaces.values().forEach(PimInterface::checkNeighborTimeouts)),
0, timeoutTaskPeriod, TimeUnit.MILLISECONDS);
scheduledExecutorService.scheduleAtFixedRate(
SafeRecurringTask.wrap(
() -> pimInterfaces.values().forEach(PIMInterface::sendJoins)),
() -> pimInterfaces.values().forEach(PimInterface::sendJoins)),
0, joinTaskPeriod, TimeUnit.MILLISECONDS);
log.info("Started");
......@@ -178,8 +178,8 @@ public class PIMInterfaceManager implements PIMInterfaceService {
}
@Override
public PIMInterface getPIMInterface(ConnectPoint cp) {
PIMInterface pi = pimInterfaces.get(cp);
public PimInterface getPimInterface(ConnectPoint cp) {
PimInterface pi = pimInterfaces.get(cp);
if (pi == null && log.isTraceEnabled()) {
log.trace("We have been asked for an Interface we don't have: {}", cp);
}
......@@ -187,7 +187,7 @@ public class PIMInterfaceManager implements PIMInterfaceService {
}
@Override
public Set<PIMInterface> getPimInterfaces() {
public Set<PimInterface> getPimInterfaces() {
return ImmutableSet.copyOf(pimInterfaces.values());
}
......@@ -216,8 +216,8 @@ public class PIMInterfaceManager implements PIMInterfaceService {
pimInterfaces.remove(cp);
}
private PIMInterface buildPimInterface(PimInterfaceConfig config, Interface intf) {
PIMInterface.Builder builder = PIMInterface.builder()
private PimInterface buildPimInterface(PimInterfaceConfig config, Interface intf) {
PimInterface.Builder builder = PimInterface.builder()
.withPacketService(packetService)
.withInterface(intf);
......@@ -231,7 +231,7 @@ public class PIMInterfaceManager implements PIMInterfaceService {
}
private void addRoute(McastRoute route) {
PIMInterface pimInterface = getSourceInterface(route);
PimInterface pimInterface = getSourceInterface(route);
if (pimInterface == null) {
return;
......@@ -241,7 +241,7 @@ public class PIMInterfaceManager implements PIMInterfaceService {
}
private void removeRoute(McastRoute route) {
PIMInterface pimInterface = routes.remove(route);
PimInterface pimInterface = routes.remove(route);
if (pimInterface == null) {
return;
......@@ -250,7 +250,7 @@ public class PIMInterfaceManager implements PIMInterfaceService {
pimInterface.removeRoute(route);
}
private PIMInterface getSourceInterface(McastRoute route) {
private PimInterface getSourceInterface(McastRoute route) {
RouteEntry routeEntry = unicastRoutingService.getLongestMatchableRouteEntry(route.source());
if (routeEntry == null) {
......@@ -265,7 +265,7 @@ public class PIMInterfaceManager implements PIMInterfaceService {
return null;
}
PIMInterface pimInterface = pimInterfaces.get(intf.connectPoint());
PimInterface pimInterface = pimInterfaces.get(intf.connectPoint());
if (pimInterface == null) {
log.warn("PIM is not enabled on interface {}", intf);
......
......@@ -26,7 +26,7 @@ import java.util.Set;
*
* TODO: Do we need a PIMInterfaceListenerService? Who sould listen to Interfaces changes?
*/
public interface PIMInterfaceService {
public interface PimInterfaceService {
/**
* Returns the PIM interface associated with the given connect point.
......@@ -34,12 +34,12 @@ public interface PIMInterfaceService {
* @param cp the connect point we want to get the PIM interface for
* @return the PIM interface if it exists, otherwise null
*/
PIMInterface getPIMInterface(ConnectPoint cp);
PimInterface getPimInterface(ConnectPoint cp);
/**
* Retrieves the set of all interfaces running PIM.
*
* @return set of PIM interfaces
*/
Set<PIMInterface> getPimInterfaces();
Set<PimInterface> getPimInterfaces();
}
......
......@@ -30,7 +30,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
/**
* Represents a PIM neighbor.
*/
public class PIMNeighbor {
public class PimNeighbor {
// IP Address of this neighbor
private final IpAddress ipAddr;
......@@ -66,7 +66,7 @@ public class PIMNeighbor {
* @param priority priority
* @param genId generation ID
*/
public PIMNeighbor(IpAddress ipAddress, MacAddress macAddress,
public PimNeighbor(IpAddress ipAddress, MacAddress macAddress,
short holdTime, int pruneDelay, int priority, int genId) {
this.ipAddr = checkNotNull(ipAddress);
this.macAddr = checkNotNull(macAddress);
......@@ -176,7 +176,7 @@ public class PIMNeighbor {
* @param opts options from the PIM HELLO packet
* @return new PIM neighbor
*/
public static PIMNeighbor createPimNeighbor(IpAddress ipAddress,
public static PimNeighbor createPimNeighbor(IpAddress ipAddress,
MacAddress macAddress,
Collection<PIMHelloOption> opts) {
......@@ -202,16 +202,16 @@ public class PIMNeighbor {
}
}
return new PIMNeighbor(ipAddress, macAddress, holdTime, pruneDelay, priority, generationID);
return new PimNeighbor(ipAddress, macAddress, holdTime, pruneDelay, priority, generationID);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof PIMNeighbor)) {
if (!(other instanceof PimNeighbor)) {
return false;
}
PIMNeighbor that = (PIMNeighbor) other;
PimNeighbor that = (PimNeighbor) other;
return this.ipAddr.equals(that.ipAddress()) &&
this.macAddr.equals(that.macAddress()) &&
......
......@@ -22,7 +22,7 @@ import org.onlab.packet.Ip4Address;
import org.onlab.packet.MacAddress;
import org.onlab.packet.PIM;
public class PIMPacket {
public class PimPacket {
// Ethernet header
private Ethernet ethHeader = new Ethernet();
......@@ -51,7 +51,7 @@ public class PIMPacket {
*
* @param type PIM.TYPE_XXXX where XXX is the PIM message type
*/
public PIMPacket(byte type) {
public PimPacket(byte type) {
pimType = type;
initDefaults();
}
......@@ -105,7 +105,7 @@ public class PIMPacket {
*
* @param payload the PIM payload
*/
public void setPIMPayload(IPacket payload) {
public void setPimPayload(IPacket payload) {
pimHeader.setPayload(payload);
payload.setParent(pimHeader);
}
......
......@@ -27,14 +27,14 @@ import static org.slf4j.LoggerFactory.getLogger;
/**
* This class will process PIM packets.
*/
public class PIMPacketHandler {
public class PimPacketHandler {
private final Logger log = getLogger(getClass());
/**
* Constructor for this class.
*/
public PIMPacketHandler() {
public PimPacketHandler() {
}
/**
......@@ -44,7 +44,7 @@ public class PIMPacketHandler {
* @param ethPkt the packet starting with the Ethernet header.
* @param pimi the PIM Interface the packet arrived on.
*/
public void processPacket(Ethernet ethPkt, PIMInterface pimi) {
public void processPacket(Ethernet ethPkt, PimInterface pimi) {
checkNotNull(ethPkt);
checkNotNull(pimi);
......
......@@ -54,6 +54,7 @@
<module>tools/package/archetypes</module>
<module>tools/package/branding</module>
<module>tools/build/conf</module>
</modules>
<url>http://onosproject.org/</url>
......@@ -74,7 +75,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<onos-build-conf.version>1.2</onos-build-conf.version>
<onos-build-conf.version>1.3-SNAPSHOT</onos-build-conf.version>
<netty4.version>4.0.33.Final</netty4.version>
<!-- TODO: replace with final release version when it is out -->
<atomix.version>1.0.0-rc3</atomix.version>
......
......@@ -31,8 +31,6 @@
<suppress files="org.onlab.packet.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onlab.jdvue.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.driver.pipeline.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.igmp.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.pim.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.segmentrouting.*" checks="AbbreviationAsWordInName" />
<!-- Suppressions for unit testing code -->
......