Renaming DHCP* to Dhcp* to follow ONOS conventions.
Change-Id: I36cfbe5b57e342af2e436e31374f1a1f49633e78
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPService.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpService.java
similarity index 96%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPService.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpService.java
index f40452a..20e1c61 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPService.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpService.java
@@ -23,14 +23,14 @@
/**
* DHCP Service Interface.
*/
-public interface DHCPService {
+public interface DhcpService {
/**
* Returns a collection of all the MacAddress to IPAddress mapping.
*
* @return collection of mappings.
*/
- Map<MacAddress, IPAssignment> listMapping();
+ Map<MacAddress, IpAssignment> listMapping();
/**
* Returns the default lease time granted by the DHCP Server.
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPStore.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpStore.java
similarity index 97%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPStore.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpStore.java
index 4114106..afdc08d 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/DHCPStore.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/DhcpStore.java
@@ -23,7 +23,7 @@
/**
* DHCPStore Interface.
*/
-public interface DHCPStore {
+public interface DhcpStore {
/**
* Appends all the IPs in a given range to the free pool of IPs.
@@ -77,7 +77,7 @@
*
* @return the collection of the mappings
*/
- Map<MacAddress, IPAssignment> listMapping();
+ Map<MacAddress, IpAssignment> listMapping();
/**
* Assigns the requested IP to the MAC ID (if available) for an indefinite period of time.
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/IPAssignment.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/IpAssignment.java
similarity index 94%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/IPAssignment.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/IpAssignment.java
index 48a3e52..4fb0f09 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/IPAssignment.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/IpAssignment.java
@@ -25,7 +25,7 @@
/**
* Stores the MAC ID to IP Address mapping details.
*/
-public final class IPAssignment {
+public final class IpAssignment {
private final Ip4Address ipAddress;
@@ -60,7 +60,7 @@
* @param leasePeriod
* @param assignmentStatus
*/
- private IPAssignment(Ip4Address ipAddress,
+ private IpAssignment(Ip4Address ipAddress,
long leasePeriod,
Date timestamp,
AssignmentStatus assignmentStatus) {
@@ -130,7 +130,7 @@
*
* @return new builder
*/
- public static Builder builder(IPAssignment assignment) {
+ public static Builder builder(IpAssignment assignment) {
return new Builder(assignment);
}
@@ -151,16 +151,16 @@
}
- private Builder(IPAssignment ipAssignment) {
+ private Builder(IpAssignment ipAssignment) {
ipAddress = ipAssignment.ipAddress();
timeStamp = ipAssignment.timestamp();
leasePeriod = ipAssignment.leasePeriod() * 1000;
assignmentStatus = ipAssignment.assignmentStatus();
}
- public IPAssignment build() {
+ public IpAssignment build() {
validateInputs();
- return new IPAssignment(ipAddress,
+ return new IpAssignment(ipAddress,
leasePeriod,
timeStamp,
assignmentStatus);
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPLeaseDetails.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpLeaseDetails.java
similarity index 89%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPLeaseDetails.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpLeaseDetails.java
index ca70418..95f49e6 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPLeaseDetails.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpLeaseDetails.java
@@ -17,21 +17,21 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
+import org.onosproject.dhcp.DhcpService;
/**
* Lists all the default lease parameters offered by the DHCP Server.
*/
@Command(scope = "onos", name = "dhcp-lease",
description = "Lists all the default lease parameters offered by the DHCP Server")
-public class DHCPLeaseDetails extends AbstractShellCommand {
+public class DhcpLeaseDetails extends AbstractShellCommand {
private static final String DHCP_LEASE_FORMAT = "Lease Time: %ds\nRenewal Time: %ds\nRebinding Time: %ds";
@Override
protected void execute() {
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
int leaseTime = dhcpService.getLeaseTime();
int renewTime = dhcpService.getRenewalTime();
int rebindTime = dhcpService.getRebindingTime();
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPListAllMappings.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpListAllMappings.java
similarity index 79%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPListAllMappings.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpListAllMappings.java
index 397c156..fc470ce 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPListAllMappings.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpListAllMappings.java
@@ -18,8 +18,8 @@
import org.apache.karaf.shell.commands.Command;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
-import org.onosproject.dhcp.IPAssignment;
+import org.onosproject.dhcp.DhcpService;
+import org.onosproject.dhcp.IpAssignment;
import java.util.Map;
@@ -28,16 +28,16 @@
*/
@Command(scope = "onos", name = "dhcp-list",
description = "Lists all the MAC to IP mappings held by the DHCP Server")
-public class DHCPListAllMappings extends AbstractShellCommand {
+public class DhcpListAllMappings extends AbstractShellCommand {
private static final String DHCP_MAPPING_FORMAT = "MAC ID: %s -> IP ASSIGNED %s";
@Override
protected void execute() {
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
- Map<MacAddress, IPAssignment> allocationMap = dhcpService.listMapping();
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
+ Map<MacAddress, IpAssignment> allocationMap = dhcpService.listMapping();
- for (Map.Entry<MacAddress, IPAssignment> entry : allocationMap.entrySet()) {
+ for (Map.Entry<MacAddress, IpAssignment> entry : allocationMap.entrySet()) {
print(DHCP_MAPPING_FORMAT, entry.getKey().toString(), entry.getValue().ipAddress().toString());
}
}
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPRemoveStaticMapping.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpRemoveStaticMapping.java
similarity index 91%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPRemoveStaticMapping.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpRemoveStaticMapping.java
index f558905..a92cd25 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPRemoveStaticMapping.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpRemoveStaticMapping.java
@@ -19,14 +19,14 @@
import org.apache.karaf.shell.commands.Command;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
+import org.onosproject.dhcp.DhcpService;
/**
* Removes a static MAC Address to IP Mapping from the DHCP Server.
*/
@Command(scope = "onos", name = "dhcp-remove-static-mapping",
description = "Removes a static MAC Address to IP Mapping from the DHCP Server")
-public class DHCPRemoveStaticMapping extends AbstractShellCommand {
+public class DhcpRemoveStaticMapping extends AbstractShellCommand {
@Argument(index = 0, name = "macAddr",
description = "MAC Address of the client",
@@ -39,7 +39,7 @@
@Override
protected void execute() {
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
try {
MacAddress macID = MacAddress.valueOf(macAddr);
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPSetStaticMapping.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpSetStaticMapping.java
similarity index 92%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPSetStaticMapping.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpSetStaticMapping.java
index 3f2ad29..9f4f658 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DHCPSetStaticMapping.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/DhcpSetStaticMapping.java
@@ -20,14 +20,14 @@
import org.onlab.packet.Ip4Address;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
+import org.onosproject.dhcp.DhcpService;
/**
* Registers a static MAC Address to IP Mapping with the DHCP Server.
*/
@Command(scope = "onos", name = "dhcp-set-static-mapping",
description = "Registers a static MAC Address to IP Mapping with the DHCP Server")
-public class DHCPSetStaticMapping extends AbstractShellCommand {
+public class DhcpSetStaticMapping extends AbstractShellCommand {
@Argument(index = 0, name = "macAddr",
description = "MAC Address of the client",
@@ -43,7 +43,7 @@
private static final String DHCP_FAILURE = "Static Mapping Failed. The IP maybe unavailable.";
@Override
protected void execute() {
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
try {
MacAddress macID = MacAddress.valueOf(macAddr);
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIPCompleter.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIpCompleter.java
similarity index 90%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIPCompleter.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIpCompleter.java
index a21b985..228d70f 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIPCompleter.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/cli/FreeIpCompleter.java
@@ -19,7 +19,7 @@
import org.apache.karaf.shell.console.completer.StringsCompleter;
import org.onlab.packet.Ip4Address;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
+import org.onosproject.dhcp.DhcpService;
import java.util.Iterator;
import java.util.List;
@@ -28,13 +28,13 @@
/**
* Free IP Completer.
*/
-public class FreeIPCompleter implements Completer {
+public class FreeIpCompleter implements Completer {
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
Iterator<Ip4Address> it = dhcpService.getAvailableIPs().iterator();
SortedSet<String> strings = delegate.getStrings();
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPConfig.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpConfig.java
similarity index 98%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPConfig.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpConfig.java
index cedae89..f8d5e63 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPConfig.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpConfig.java
@@ -22,7 +22,7 @@
/**
* DHCP Config class.
*/
-public class DHCPConfig extends Config<ApplicationId> {
+public class DhcpConfig extends Config<ApplicationId> {
public static final String MY_IP = "ip";
public static final String MY_MAC = "mac";
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPManager.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
similarity index 95%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPManager.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
index 854cc79..24cb087 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPManager.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
@@ -36,9 +36,9 @@
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
-import org.onosproject.dhcp.DHCPService;
-import org.onosproject.dhcp.DHCPStore;
-import org.onosproject.dhcp.IPAssignment;
+import org.onosproject.dhcp.DhcpService;
+import org.onosproject.dhcp.DhcpStore;
+import org.onosproject.dhcp.IpAssignment;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigEvent;
import org.onosproject.net.config.NetworkConfigListener;
@@ -81,7 +81,7 @@
*/
@Component(immediate = true)
@Service
-public class DHCPManager implements DHCPService {
+public class DhcpManager implements DhcpService {
private static final ProviderId PID = new ProviderId("of", "org.onosproject.dhcp", true);
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -89,20 +89,20 @@
private final NetworkConfigListener cfgListener = new InternalConfigListener();
private final Set<ConfigFactory> factories = ImmutableSet.of(
- new ConfigFactory<ApplicationId, DHCPConfig>(APP_SUBJECT_FACTORY,
- DHCPConfig.class,
+ new ConfigFactory<ApplicationId, DhcpConfig>(APP_SUBJECT_FACTORY,
+ DhcpConfig.class,
"dhcp") {
@Override
- public DHCPConfig createConfig() {
- return new DHCPConfig();
+ public DhcpConfig createConfig() {
+ return new DhcpConfig();
}
},
- new ConfigFactory<ApplicationId, DHCPStoreConfig>(APP_SUBJECT_FACTORY,
- DHCPStoreConfig.class,
+ new ConfigFactory<ApplicationId, DhcpStoreConfig>(APP_SUBJECT_FACTORY,
+ DhcpStoreConfig.class,
"dhcpstore") {
@Override
- public DHCPStoreConfig createConfig() {
- return new DHCPStoreConfig();
+ public DhcpStoreConfig createConfig() {
+ return new DhcpStoreConfig();
}
}
);
@@ -118,7 +118,7 @@
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DHCPStore dhcpStore;
+ protected DhcpStore dhcpStore;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected HostProviderRegistry hostProviderRegistry;
@@ -214,7 +214,7 @@
}
@Override
- public Map<MacAddress, IPAssignment> listMapping() {
+ public Map<MacAddress, IpAssignment> listMapping() {
return dhcpStore.listMapping();
}
@@ -580,7 +580,7 @@
*
* @param cfg configuration object
*/
- private void reconfigureNetwork(DHCPConfig cfg) {
+ private void reconfigureNetwork(DhcpConfig cfg) {
if (cfg.ip() != null) {
myIP = cfg.ip();
@@ -619,7 +619,7 @@
*
* @param cfg configuration object
*/
- private void reconfigureStore(DHCPStoreConfig cfg) {
+ private void reconfigureStore(DhcpStoreConfig cfg) {
if (cfg.defaultTimeout() != null) {
dhcpStore.setDefaultTimeoutForPurge(Integer.valueOf(cfg.defaultTimeout()));
@@ -638,13 +638,13 @@
if ((event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED)) {
- if (event.configClass().equals(DHCPConfig.class)) {
- DHCPConfig cfg = cfgService.getConfig(appId, DHCPConfig.class);
+ if (event.configClass().equals(DhcpConfig.class)) {
+ DhcpConfig cfg = cfgService.getConfig(appId, DhcpConfig.class);
reconfigureNetwork(cfg);
log.info("Reconfigured Manager");
}
- if (event.configClass().equals(DHCPStoreConfig.class)) {
- DHCPStoreConfig cfg = cfgService.getConfig(appId, DHCPStoreConfig.class);
+ if (event.configClass().equals(DhcpStoreConfig.class)) {
+ DhcpStoreConfig cfg = cfgService.getConfig(appId, DhcpStoreConfig.class);
reconfigureStore(cfg);
log.info("Reconfigured Store");
}
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPStoreConfig.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpStoreConfig.java
similarity index 97%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPStoreConfig.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpStoreConfig.java
index 743450c..0059e7e 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPStoreConfig.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpStoreConfig.java
@@ -22,7 +22,7 @@
/**
* DHCP Store Config class.
*/
-public class DHCPStoreConfig extends Config<ApplicationId> {
+public class DhcpStoreConfig extends Config<ApplicationId> {
public static final String TIMER_DELAY = "delay";
public static final String DEFAULT_TIMEOUT = "timeout";
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPUi.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpUi.java
similarity index 95%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPUi.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpUi.java
index 8e338b3..bb2bd2c 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DHCPUi.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpUi.java
@@ -37,11 +37,11 @@
* Mechanism to stream data to the GUI.
*/
@Component(immediate = true, enabled = true)
-@Service(value = DHCPUi.class)
-public class DHCPUi {
+@Service(value = DhcpUi.class)
+public class DhcpUi {
private final Logger log = LoggerFactory.getLogger(getClass());
- private static final ClassLoader CL = DHCPUi.class.getClassLoader();
+ private static final ClassLoader CL = DhcpUi.class.getClassLoader();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected UiExtensionService uiExtensionService;
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpViewMessageHandler.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpViewMessageHandler.java
index 50a6802..89ed572 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpViewMessageHandler.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpViewMessageHandler.java
@@ -19,8 +19,8 @@
import com.google.common.collect.ImmutableSet;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.dhcp.DHCPService;
-import org.onosproject.dhcp.IPAssignment;
+import org.onosproject.dhcp.DhcpService;
+import org.onosproject.dhcp.IpAssignment;
import org.onosproject.ui.RequestHandler;
import org.onosproject.ui.UiMessageHandler;
import org.onosproject.ui.table.TableModel;
@@ -72,15 +72,15 @@
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
- DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
- Map<MacAddress, IPAssignment> allocationMap = dhcpService.listMapping();
+ DhcpService dhcpService = AbstractShellCommand.get(DhcpService.class);
+ Map<MacAddress, IpAssignment> allocationMap = dhcpService.listMapping();
- for (Map.Entry<MacAddress, IPAssignment> entry : allocationMap.entrySet()) {
+ for (Map.Entry<MacAddress, IpAssignment> entry : allocationMap.entrySet()) {
populateRow(tm.addRow(), entry);
}
}
- private void populateRow(TableModel.Row row, Map.Entry<MacAddress, IPAssignment> entry) {
+ private void populateRow(TableModel.Row row, Map.Entry<MacAddress, IpAssignment> entry) {
if (entry.getValue().leasePeriod() > 0) {
Date now = new Date(entry.getValue().timestamp().getTime() + entry.getValue().leasePeriod());
row.cell(MAC, entry.getKey())
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDHCPStore.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
similarity index 82%
rename from apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDHCPStore.java
rename to apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
index 5f6e145..6e29216 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDHCPStore.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
@@ -28,8 +28,8 @@
import org.onlab.packet.MacAddress;
import org.onlab.util.KryoNamespace;
import org.onlab.util.Timer;
-import org.onosproject.dhcp.DHCPStore;
-import org.onosproject.dhcp.IPAssignment;
+import org.onosproject.dhcp.DhcpStore;
+import org.onosproject.dhcp.IpAssignment;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.ConsistentMap;
import org.onosproject.store.service.DistributedSet;
@@ -51,14 +51,14 @@
@Component(immediate = true)
@Service
-public class DistributedDHCPStore implements DHCPStore {
+public class DistributedDhcpStore implements DhcpStore {
private final Logger log = LoggerFactory.getLogger(getClass());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected StorageService storageService;
- private ConsistentMap<MacAddress, IPAssignment> allocationMap;
+ private ConsistentMap<MacAddress, IpAssignment> allocationMap;
private DistributedSet<Ip4Address> freeIPPool;
@@ -76,13 +76,13 @@
@Activate
protected void activate() {
- allocationMap = storageService.<MacAddress, IPAssignment>consistentMapBuilder()
+ allocationMap = storageService.<MacAddress, IpAssignment>consistentMapBuilder()
.withName("onos-dhcp-assignedIP")
.withSerializer(Serializer.using(
new KryoNamespace.Builder()
.register(KryoNamespaces.API)
- .register(IPAssignment.class,
- IPAssignment.AssignmentStatus.class,
+ .register(IpAssignment.class,
+ IpAssignment.AssignmentStatus.class,
Date.class,
long.class,
Ip4Address.class)
@@ -108,27 +108,27 @@
@Override
public Ip4Address suggestIP(MacAddress macID, Ip4Address requestedIP) {
- IPAssignment assignmentInfo;
+ IpAssignment assignmentInfo;
if (allocationMap.containsKey(macID)) {
assignmentInfo = allocationMap.get(macID).value();
- IPAssignment.AssignmentStatus status = assignmentInfo.assignmentStatus();
+ IpAssignment.AssignmentStatus status = assignmentInfo.assignmentStatus();
Ip4Address ipAddr = assignmentInfo.ipAddress();
- if (status == IPAssignment.AssignmentStatus.Option_Assigned ||
- status == IPAssignment.AssignmentStatus.Option_Requested) {
+ if (status == IpAssignment.AssignmentStatus.Option_Assigned ||
+ status == IpAssignment.AssignmentStatus.Option_Requested) {
// Client has a currently Active Binding.
if ((ipAddr.toInt() > startIPRange.toInt()) && (ipAddr.toInt() < endIPRange.toInt())) {
return ipAddr;
}
- } else if (status == IPAssignment.AssignmentStatus.Option_Expired) {
+ } else if (status == IpAssignment.AssignmentStatus.Option_Expired) {
// Client has a Released or Expired Binding.
if (freeIPPool.contains(ipAddr)) {
- assignmentInfo = IPAssignment.builder()
+ assignmentInfo = IpAssignment.builder()
.ipAddress(ipAddr)
.timestamp(new Date())
.leasePeriod(timeoutForPendingAssignments)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Requested)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Requested)
.build();
if (freeIPPool.remove(ipAddr)) {
allocationMap.put(macID, assignmentInfo);
@@ -141,11 +141,11 @@
} else if (requestedIP.toInt() != 0) {
// Client has requested an IP.
if (freeIPPool.contains(requestedIP)) {
- assignmentInfo = IPAssignment.builder()
+ assignmentInfo = IpAssignment.builder()
.ipAddress(requestedIP)
.timestamp(new Date())
.leasePeriod(timeoutForPendingAssignments)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Requested)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Requested)
.build();
if (freeIPPool.remove(requestedIP)) {
allocationMap.put(macID, assignmentInfo);
@@ -156,11 +156,11 @@
// Allocate a new IP from the server's pool of available IP.
Ip4Address nextIPAddr = fetchNextIP();
- assignmentInfo = IPAssignment.builder()
+ assignmentInfo = IpAssignment.builder()
.ipAddress(nextIPAddr)
.timestamp(new Date())
.leasePeriod(timeoutForPendingAssignments)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Requested)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Requested)
.build();
allocationMap.put(macID, assignmentInfo);
@@ -171,27 +171,27 @@
@Override
public boolean assignIP(MacAddress macID, Ip4Address ipAddr, int leaseTime) {
- IPAssignment assignmentInfo;
+ IpAssignment assignmentInfo;
if (allocationMap.containsKey(macID)) {
assignmentInfo = allocationMap.get(macID).value();
if ((assignmentInfo.ipAddress().toInt() == ipAddr.toInt()) &&
(ipAddr.toInt() > startIPRange.toInt()) && (ipAddr.toInt() < endIPRange.toInt())) {
- assignmentInfo = IPAssignment.builder()
+ assignmentInfo = IpAssignment.builder()
.ipAddress(ipAddr)
.timestamp(new Date())
.leasePeriod(leaseTime)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Assigned)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Assigned)
.build();
allocationMap.put(macID, assignmentInfo);
return true;
}
} else if (freeIPPool.contains(ipAddr)) {
- assignmentInfo = IPAssignment.builder()
+ assignmentInfo = IpAssignment.builder()
.ipAddress(ipAddr)
.timestamp(new Date())
.leasePeriod(leaseTime)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Assigned)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Assigned)
.build();
if (freeIPPool.remove(ipAddr)) {
allocationMap.put(macID, assignmentInfo);
@@ -204,8 +204,8 @@
@Override
public void releaseIP(MacAddress macID) {
if (allocationMap.containsKey(macID)) {
- IPAssignment newAssignment = IPAssignment.builder(allocationMap.get(macID).value())
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Expired)
+ IpAssignment newAssignment = IpAssignment.builder(allocationMap.get(macID).value())
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Expired)
.build();
Ip4Address freeIP = newAssignment.ipAddress();
allocationMap.put(macID, newAssignment);
@@ -224,12 +224,12 @@
}
@Override
- public Map<MacAddress, IPAssignment> listMapping() {
+ public Map<MacAddress, IpAssignment> listMapping() {
- Map<MacAddress, IPAssignment> allMapping = new HashMap<>();
- for (Map.Entry<MacAddress, Versioned<IPAssignment>> entry: allocationMap.entrySet()) {
- IPAssignment assignment = entry.getValue().value();
- if (assignment.assignmentStatus() == IPAssignment.AssignmentStatus.Option_Assigned) {
+ Map<MacAddress, IpAssignment> allMapping = new HashMap<>();
+ for (Map.Entry<MacAddress, Versioned<IpAssignment>> entry: allocationMap.entrySet()) {
+ IpAssignment assignment = entry.getValue().value();
+ if (assignment.assignmentStatus() == IpAssignment.AssignmentStatus.Option_Assigned) {
allMapping.put(entry.getKey(), assignment);
}
}
@@ -245,7 +245,7 @@
@Override
public boolean removeStaticIP(MacAddress macID) {
if (allocationMap.containsKey(macID)) {
- IPAssignment assignment = allocationMap.get(macID).value();
+ IpAssignment assignment = allocationMap.get(macID).value();
Ip4Address freeIP = assignment.ipAddress();
if (assignment.leasePeriod() < 0) {
allocationMap.remove(macID);
@@ -297,17 +297,17 @@
@Override
public void run(Timeout to) {
- IPAssignment ipAssignment, newAssignment;
+ IpAssignment ipAssignment, newAssignment;
Date dateNow = new Date();
- for (Map.Entry<MacAddress, Versioned<IPAssignment>> entry: allocationMap.entrySet()) {
+ for (Map.Entry<MacAddress, Versioned<IpAssignment>> entry: allocationMap.entrySet()) {
ipAssignment = entry.getValue().value();
long timeLapsed = dateNow.getTime() - ipAssignment.timestamp().getTime();
- if ((ipAssignment.assignmentStatus() != IPAssignment.AssignmentStatus.Option_Expired) &&
+ if ((ipAssignment.assignmentStatus() != IpAssignment.AssignmentStatus.Option_Expired) &&
(ipAssignment.leasePeriod() > 0) && (timeLapsed > (ipAssignment.leasePeriod()))) {
Ip4Address freeIP = ipAssignment.ipAddress();
- newAssignment = IPAssignment.builder(ipAssignment)
- .assignmentStatus(IPAssignment.AssignmentStatus.Option_Expired)
+ newAssignment = IpAssignment.builder(ipAssignment)
+ .assignmentStatus(IpAssignment.AssignmentStatus.Option_Expired)
.build();
allocationMap.put(entry.getKey(), newAssignment);
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/rest/DHCPWebResource.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/rest/DHCPWebResource.java
index b18acd5..38df577 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/rest/DHCPWebResource.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/rest/DHCPWebResource.java
@@ -20,8 +20,8 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.MacAddress;
-import org.onosproject.dhcp.DHCPService;
-import org.onosproject.dhcp.IPAssignment;
+import org.onosproject.dhcp.DhcpService;
+import org.onosproject.dhcp.IpAssignment;
import org.onosproject.rest.AbstractWebResource;
import javax.ws.rs.Consumes;
@@ -42,7 +42,7 @@
@Path("dhcp")
public class DHCPWebResource extends AbstractWebResource {
- final DHCPService service = get(DHCPService.class);
+ final DhcpService service = get(DhcpService.class);
/**
* Get DHCP server configuration data.
@@ -53,7 +53,7 @@
@GET
@Path("config")
public Response getConfigs() {
- DHCPService service = get(DHCPService.class);
+ DhcpService service = get(DhcpService.class);
ObjectNode node = mapper().createObjectNode()
.put("leaseTime", service.getLeaseTime())
.put("renewalTime", service.getRenewalTime())
@@ -72,7 +72,7 @@
public Response listMappings() {
ObjectNode root = mapper().createObjectNode();
- final Map<MacAddress, IPAssignment> intents = service.listMapping();
+ final Map<MacAddress, IpAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
@@ -124,7 +124,7 @@
}
}
- final Map<MacAddress, IPAssignment> intents = service.listMapping();
+ final Map<MacAddress, IpAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
@@ -150,7 +150,7 @@
if (!service.removeStaticMapping(MacAddress.valueOf(macID))) {
throw new IllegalArgumentException("Static Mapping Removal Failed.");
}
- final Map<MacAddress, IPAssignment> intents = service.listMapping();
+ final Map<MacAddress, IpAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())