Simplify method names by removing redundancy
Change-Id: I36df7e23792f7004dfae823a8700f6c887ea1efd
diff --git a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceDeviceListener.java b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceDeviceListener.java
index 0c94ab5..3ff3706 100644
--- a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceDeviceListener.java
+++ b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceDeviceListener.java
@@ -127,25 +127,25 @@
}
private void registerDeviceResource(Device device) {
- executor.submit(() -> adminService.registerResources(Resources.discrete(device.id()).resource()));
+ executor.submit(() -> adminService.register(Resources.discrete(device.id()).resource()));
}
private void unregisterDeviceResource(Device device) {
executor.submit(() -> {
DiscreteResource devResource = Resources.discrete(device.id()).resource();
List<Resource> allResources = getDescendantResources(devResource);
- adminService.unregisterResources(Lists.transform(allResources, Resource::id));
+ adminService.unregister(Lists.transform(allResources, Resource::id));
});
}
private void registerPortResource(Device device, Port port) {
Resource portPath = Resources.discrete(device.id(), port.number()).resource();
executor.submit(() -> {
- adminService.registerResources(portPath);
+ adminService.register(portPath);
queryBandwidth(device.id(), port.number())
.map(bw -> portPath.child(Bandwidth.class, bw.bps()))
- .map(adminService::registerResources)
+ .map(adminService::register)
.ifPresent(success -> {
if (!success) {
log.error("Failed to register Bandwidth for {}", portPath.id());
@@ -155,33 +155,33 @@
// for VLAN IDs
Set<VlanId> vlans = queryVlanIds(device.id(), port.number());
if (!vlans.isEmpty()) {
- adminService.registerResources(vlans.stream()
- .map(portPath::child)
- .collect(Collectors.toList()));
+ adminService.register(vlans.stream()
+ .map(portPath::child)
+ .collect(Collectors.toList()));
}
// for MPLS labels
Set<MplsLabel> mplsLabels = queryMplsLabels(device.id(), port.number());
if (!mplsLabels.isEmpty()) {
- adminService.registerResources(mplsLabels.stream()
- .map(portPath::child)
- .collect(Collectors.toList()));
+ adminService.register(mplsLabels.stream()
+ .map(portPath::child)
+ .collect(Collectors.toList()));
}
// for Lambdas
Set<OchSignal> lambdas = queryLambdas(device.id(), port.number());
if (!lambdas.isEmpty()) {
- adminService.registerResources(lambdas.stream()
- .map(portPath::child)
- .collect(Collectors.toList()));
+ adminService.register(lambdas.stream()
+ .map(portPath::child)
+ .collect(Collectors.toList()));
}
// for Tributary slots
Set<TributarySlot> tSlots = queryTributarySlots(device.id(), port.number());
if (!tSlots.isEmpty()) {
- adminService.registerResources(tSlots.stream()
- .map(portPath::child)
- .collect(Collectors.toList()));
+ adminService.register(tSlots.stream()
+ .map(portPath::child)
+ .collect(Collectors.toList()));
}
});
}
@@ -190,7 +190,7 @@
executor.submit(() -> {
DiscreteResource portResource = Resources.discrete(device.id(), port.number()).resource();
List<Resource> allResources = getDescendantResources(portResource);
- adminService.unregisterResources(Lists.transform(allResources, Resource::id));
+ adminService.unregister(Lists.transform(allResources, Resource::id));
});
}
diff --git a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java
index 7ce8c28..878f202 100644
--- a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceManager.java
@@ -171,14 +171,14 @@
}
@Override
- public boolean registerResources(List<Resource> resources) {
+ public boolean register(List<Resource> resources) {
checkNotNull(resources);
return store.register(resources);
}
@Override
- public boolean unregisterResources(List<ResourceId> ids) {
+ public boolean unregister(List<ResourceId> ids) {
checkNotNull(ids);
return store.unregister(ids);
diff --git a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceNetworkConfigListener.java b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceNetworkConfigListener.java
index 39ab964..ae2b406 100644
--- a/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceNetworkConfigListener.java
+++ b/core/net/src/main/java/org/onosproject/net/newresource/impl/ResourceNetworkConfigListener.java
@@ -93,7 +93,7 @@
switch (event.type()) {
case CONFIG_ADDED:
- if (!adminService.registerResources(Resources.continuous(cp.deviceId(),
+ if (!adminService.register(Resources.continuous(cp.deviceId(),
cp.port(), Bandwidth.class)
.resource(bwCapacity.capacity().bps()))) {
log.info("Failed to register Bandwidth for {}, attempting update", cp);
@@ -115,7 +115,7 @@
case CONFIG_REMOVED:
// FIXME Following should be an update to the value based on port speed
- if (!adminService.unregisterResources(Resources.continuous(cp.deviceId(),
+ if (!adminService.unregister(Resources.continuous(cp.deviceId(),
cp.port(),
Bandwidth.class).id())) {
log.warn("Failed to unregister Bandwidth for {}", cp);
@@ -147,11 +147,11 @@
// but both unregisterResources(..) and registerResources(..)
// returns true (success)
- if (!adminService.unregisterResources(
+ if (!adminService.unregister(
Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class).id())) {
log.warn("unregisterResources for {} failed", cp);
}
- return adminService.registerResources(Resources.continuous(cp.deviceId(),
+ return adminService.register(Resources.continuous(cp.deviceId(),
cp.port(),
Bandwidth.class).resource(bwCapacity.capacity().bps()));
}