Refactor: extract static values to Constants class, split packages
Change-Id: I5d9f07b6e0d82b40d9c1fa216b233af881ff11ab
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommand.java
similarity index 95%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommand.java
index 75db695..b7d413c 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.cli;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommandCompleter.java
similarity index 94%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommandCompleter.java
index f497721..d216bac 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/SimpleFabricCommandCompleter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.cli;
import com.google.common.collect.Lists;
import org.apache.karaf.shell.console.completer.ArgumentCompleter;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/package-info.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/package-info.java
new file mode 100644
index 0000000..1a92219
--- /dev/null
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Simple fabric CLI package.
+ */
+package org.onosproject.simplefabric.cli;
\ No newline at end of file
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricConfig.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricConfig.java
similarity index 98%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricConfig.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricConfig.java
index fada766..b163660 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricConfig.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.Sets;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricL2Forward.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricL2Forward.java
similarity index 97%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricL2Forward.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricL2Forward.java
index 45a9fdd..819beee 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricL2Forward.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricL2Forward.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.impl;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -63,6 +63,10 @@
import java.util.Map;
import java.util.stream.Collectors;
+import static org.onosproject.simplefabric.api.Constants.L2FORWARD_APP_ID;
+import static org.onosproject.simplefabric.api.Constants.PRI_L2NETWORK_BROADCAST;
+import static org.onosproject.simplefabric.api.Constants.PRI_L2NETWORK_UNICAST;
+
/**
* An implementation of L2NetworkOperationService.
@@ -101,7 +105,7 @@
@Activate
public void activate() {
- l2ForwardAppId = coreService.registerApplication(simpleFabric.L2FORWARD_APP_ID);
+ l2ForwardAppId = coreService.registerApplication(L2FORWARD_APP_ID);
log.info("simple fabric l2 forwaring starting with l2net app id {}", l2ForwardAppId.toString());
simpleFabric.addListener(simpleFabricListener);
@@ -294,7 +298,7 @@
.filteredIngressPoint(srcFcp)
.filteredEgressPoints(dstFcps)
.constraints(buildConstraints(L2NETWORK_CONSTRAINTS, l2Network.encapsulation()))
- .priority(SimpleFabricService.PRI_L2NETWORK_BROADCAST)
+ .priority(PRI_L2NETWORK_BROADCAST)
.resourceGroup(resourceGroup);
brcIntents.add(intentBuilder.build());
});
@@ -325,7 +329,7 @@
.filteredIngressPoints(srcFcps)
.filteredEgressPoint(hostFcp)
.constraints(buildConstraints(L2NETWORK_CONSTRAINTS, l2Network.encapsulation()))
- .priority(SimpleFabricService.PRI_L2NETWORK_UNICAST)
+ .priority(PRI_L2NETWORK_UNICAST)
.resourceGroup(resourceGroup);
uniIntents.add(intentBuilder.build());
});
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricManager.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
similarity index 94%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricManager.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
index 445fb71..59f26f0 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricManager.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.impl;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
@@ -29,42 +29,42 @@
import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.ARP;
import org.onlab.packet.Ethernet;
+import org.onlab.packet.IPv6;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
-import org.onlab.packet.IPv6;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onlab.packet.ndp.NeighborSolicitation;
import org.onosproject.app.ApplicationService;
+import org.onosproject.component.ComponentService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
-import org.onosproject.component.ComponentService;
import org.onosproject.event.ListenerRegistry;
-import org.onosproject.net.intf.Interface;
-import org.onosproject.net.intf.InterfaceService;
-import org.onosproject.net.intf.InterfaceListener;
-import org.onosproject.net.intf.InterfaceEvent;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Host;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigEvent;
import org.onosproject.net.config.NetworkConfigListener;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.config.basics.SubjectFactories;
-import org.onosproject.net.ConnectPoint;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.Host;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.HostListener;
import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.packet.PacketService;
+import org.onosproject.net.host.HostListener;
+import org.onosproject.net.host.HostService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceEvent;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.OutboundPacket;
+import org.onosproject.net.packet.PacketService;
import org.onosproject.simplefabric.api.IpSubnet;
import org.onosproject.simplefabric.api.L2Network;
import org.onosproject.simplefabric.api.Route;
@@ -77,12 +77,20 @@
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.ByteBuffer;
-import java.util.HashSet;
import java.util.Collection;
-import java.util.Set;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
-import static org.onosproject.simplefabric.RouteTools.createBinaryString;
+import static org.onosproject.simplefabric.util.RouteTools.createBinaryString;
+import static org.onosproject.simplefabric.api.Constants.ALLOW_ETH_ADDRESS_SELECTOR;
+import static org.onosproject.simplefabric.api.Constants.ALLOW_IPV6;
+import static org.onosproject.simplefabric.api.Constants.APP_ID;
+import static org.onosproject.simplefabric.api.Constants.IDLE_INTERVAL_MSEC;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_ALLOW_LINK_CP;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_HASHED_PATH_SELECTION;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_MATCH_IP_PROTO;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_SINGLE_TO_SINGLE;
/**
@@ -187,7 +195,7 @@
componentService.activate(appId, SimpleFabricNeighbour.class.getName());
componentService.activate(appId, SimpleFabricReactiveRouting.class.getName());
- if (SimpleFabricService.ALLOW_ETH_ADDRESS_SELECTOR) {
+ if (ALLOW_ETH_ADDRESS_SELECTOR) {
componentService.activate(appId, SimpleFabricL2Forward.class.getName());
}
@@ -203,7 +211,7 @@
componentService.deactivate(appId, SimpleFabricNeighbour.class.getName());
componentService.deactivate(appId, SimpleFabricReactiveRouting.class.getName());
- if (SimpleFabricService.ALLOW_ETH_ADDRESS_SELECTOR) {
+ if (ALLOW_ETH_ADDRESS_SELECTOR) {
componentService.deactivate(appId, SimpleFabricL2Forward.class.getName());
}
@@ -490,18 +498,12 @@
protected void dump(String subject, PrintStream out) {
if ("show".equals(subject)) {
out.println("Static Configuration Flag:");
- out.println(" ALLOW_IPV6="
- + SimpleFabricService.ALLOW_IPV6);
- out.println(" ALLOW_ETH_ADDRESS_SELECTOR="
- + SimpleFabricService.ALLOW_ETH_ADDRESS_SELECTOR);
- out.println(" REACTIVE_SINGLE_TO_SINGLE="
- + SimpleFabricService.REACTIVE_SINGLE_TO_SINGLE);
- out.println(" REACTIVE_ALLOW_LINK_CP="
- + SimpleFabricService.REACTIVE_ALLOW_LINK_CP);
- out.println(" REACTIVE_HASHED_PATH_SELECTION="
- + SimpleFabricService.REACTIVE_HASHED_PATH_SELECTION);
- out.println(" REACTIVE_MATCH_IP_PROTO="
- + SimpleFabricService.REACTIVE_MATCH_IP_PROTO);
+ out.println(" ALLOW_IPV6=" + ALLOW_IPV6);
+ out.println(" ALLOW_ETH_ADDRESS_SELECTOR=" + ALLOW_ETH_ADDRESS_SELECTOR);
+ out.println(" REACTIVE_SINGLE_TO_SINGLE=" + REACTIVE_SINGLE_TO_SINGLE);
+ out.println(" REACTIVE_ALLOW_LINK_CP=" + REACTIVE_ALLOW_LINK_CP);
+ out.println(" REACTIVE_HASHED_PATH_SELECTION=" + REACTIVE_HASHED_PATH_SELECTION);
+ out.println(" REACTIVE_MATCH_IP_PROTO=" + REACTIVE_MATCH_IP_PROTO);
out.println("");
out.println("SimpleFabricAppId:");
out.println(" " + getAppId());
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricNeighbour.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricNeighbour.java
similarity index 98%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricNeighbour.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricNeighbour.java
index 1b5330c..9924343 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricNeighbour.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricNeighbour.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricReactiveRouting.java
similarity index 94%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricReactiveRouting.java
index 4f83ae3..8dab9c8 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricReactiveRouting.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.impl;
import com.google.common.collect.ImmutableList;
import org.apache.felix.scr.annotations.Activate;
@@ -27,41 +27,41 @@
import org.onlab.packet.ICMP6;
import org.onlab.packet.IPv4;
import org.onlab.packet.IPv6;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip4Prefix;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.Ip6Prefix;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
-import org.onosproject.net.FilteredConnectPoint;
-import org.onosproject.net.intf.InterfaceService;
import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.EncapsulationType;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.EncapsulationType;
+import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.Host;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleService;
-import org.onosproject.net.Host;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.host.HostService;
import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.constraint.EncapsulationConstraint;
-import org.onosproject.net.intent.constraint.PartialFailureConstraint;
-import org.onosproject.net.intent.constraint.HashedPathSelectionConstraint;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.Key;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
+import org.onosproject.net.intent.constraint.EncapsulationConstraint;
+import org.onosproject.net.intent.constraint.HashedPathSelectionConstraint;
+import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceService;
import org.onosproject.net.link.LinkService;
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.InboundPacket;
@@ -88,6 +88,20 @@
import java.util.List;
import java.util.Set;
+import static org.onosproject.simplefabric.api.Constants.ALLOW_ETH_ADDRESS_SELECTOR;
+import static org.onosproject.simplefabric.api.Constants.ALLOW_IPV6;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_BORDER_BASE;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_BORDER_FORWARD;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_BORDER_INTERCEPT;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_BORDER_STEP;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_LOCAL_FORWARD;
+import static org.onosproject.simplefabric.api.Constants.PRI_REACTIVE_LOCAL_INTERCEPT;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_ALLOW_LINK_CP;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_APP_ID;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_HASHED_PATH_SELECTION;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_MATCH_IP_PROTO;
+import static org.onosproject.simplefabric.api.Constants.REACTIVE_SINGLE_TO_SINGLE;
+
/**
* SimpleFabricReactiveRouting handles L3 Reactive Routing.
@@ -140,13 +154,13 @@
@Activate
public void activate() {
- reactiveAppId = coreService.registerApplication(simpleFabric.REACTIVE_APP_ID);
+ reactiveAppId = coreService.registerApplication(REACTIVE_APP_ID);
log.info("simple fabric reactive routing starting with app id {}", reactiveAppId.toString());
// NOTE: may not clear at init for MIGHT generate pending_remove garbages
// use flush event from simple fabric cli command
- if (simpleFabric.REACTIVE_HASHED_PATH_SELECTION) {
+ if (REACTIVE_HASHED_PATH_SELECTION) {
reactiveConstraints = ImmutableList.of(new PartialFailureConstraint(),
new HashedPathSelectionConstraint());
} else {
@@ -194,7 +208,7 @@
DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_IPV4).build(),
PacketPriority.REACTIVE, reactiveAppId);
- if (simpleFabric.ALLOW_IPV6) {
+ if (ALLOW_IPV6) {
packetService.requestPackets(
DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_IPV6).build(),
PacketPriority.REACTIVE, reactiveAppId);
@@ -213,7 +227,7 @@
DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_IPV4).build(),
PacketPriority.REACTIVE, reactiveAppId);
- if (simpleFabric.ALLOW_IPV6) {
+ if (ALLOW_IPV6) {
packetService.cancelPackets(
DefaultTrafficSelector.builder().matchEthType(Ethernet.TYPE_IPV6).build(),
PacketPriority.REACTIVE, reactiveAppId);
@@ -369,7 +383,7 @@
continue;
}
if (!(simpleFabric.findL2Network(intent.egressPoint(), VlanId.NONE) != null ||
- (simpleFabric.REACTIVE_ALLOW_LINK_CP &&
+ (REACTIVE_ALLOW_LINK_CP &&
!linkService.getEgressLinks(intent.egressPoint()).isEmpty()))) {
log.info("refresh route intents; remove intent for egress point not available: key={}", intent.key());
intentService.withdraw(intentService.getIntent(intent.key()));
@@ -378,7 +392,7 @@
}
// MAY NEED TO CHECK: intent.egressPoint and intent.treatment's dstMac is valid against hosts
- if (simpleFabric.REACTIVE_SINGLE_TO_SINGLE && !simpleFabric.REACTIVE_ALLOW_LINK_CP) {
+ if (REACTIVE_SINGLE_TO_SINGLE && !REACTIVE_ALLOW_LINK_CP) {
// single path intent only; no need to check ingress points
continue;
}
@@ -388,7 +402,7 @@
for (FilteredConnectPoint cp : intent.filteredIngressPoints()) {
if (deviceService.isAvailable(cp.connectPoint().deviceId()) &&
(simpleFabric.findL2Network(cp.connectPoint(), VlanId.NONE) != null ||
- (simpleFabric.REACTIVE_ALLOW_LINK_CP &&
+ (REACTIVE_ALLOW_LINK_CP &&
!linkService.getIngressLinks(cp.connectPoint()).isEmpty()))) {
newIngressPoints.add(cp);
} else {
@@ -657,7 +671,7 @@
if (dstSubnet != null) {
// destination is local subnet ip
- if (SimpleFabricService.ALLOW_ETH_ADDRESS_SELECTOR && dstSubnet.equals(srcSubnet)) {
+ if (ALLOW_ETH_ADDRESS_SELECTOR && dstSubnet.equals(srcSubnet)) {
// NOTE: if ALLOW_ETH_ADDRESS_SELECTOR=false; l2Forward is always false
L2Network l2Network = simpleFabric.findL2Network(dstSubnet.l2NetworkName());
treatmentSrcMac = ethPkt.getSourceMAC();
@@ -749,7 +763,7 @@
EncapsulationType encap, boolean updateMac,
boolean isDstLocalSubnet, int borderRoutePrefixLength) {
if (!(simpleFabric.findL2Network(srcCp, VlanId.NONE) != null ||
- (simpleFabric.REACTIVE_ALLOW_LINK_CP && !linkService.getIngressLinks(srcCp).isEmpty()))) {
+ (REACTIVE_ALLOW_LINK_CP && !linkService.getIngressLinks(srcCp).isEmpty()))) {
log.warn("NO REGI for srcCp not in L2Network; srcCp={} srcPrefix={} dstPrefix={} nextHopIp={}",
srcCp, srcPrefix, dstPrefix, nextHopIp);
return false;
@@ -772,7 +786,7 @@
return false;
}
TrafficTreatment treatment;
- if (updateMac && simpleFabric.ALLOW_ETH_ADDRESS_SELECTOR) {
+ if (updateMac && ALLOW_ETH_ADDRESS_SELECTOR) {
treatment = generateSetMacTreatment(nextHopMac, treatmentSrcMac);
} else {
treatment = DefaultTrafficTreatment.builder().build();
@@ -781,34 +795,34 @@
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
if (dstPrefix.isIp4()) {
selector.matchEthType(Ethernet.TYPE_IPV4);
- if (simpleFabric.REACTIVE_SINGLE_TO_SINGLE && srcPrefix.prefixLength() > 0) {
+ if (REACTIVE_SINGLE_TO_SINGLE && srcPrefix.prefixLength() > 0) {
selector.matchIPSrc(srcPrefix);
}
if (dstPrefix.prefixLength() > 0) {
selector.matchIPDst(dstPrefix);
}
- if (ipProto != 0 && simpleFabric.REACTIVE_MATCH_IP_PROTO) {
+ if (ipProto != 0 && REACTIVE_MATCH_IP_PROTO) {
selector.matchIPProtocol(ipProto);
}
} else {
selector.matchEthType(Ethernet.TYPE_IPV6);
- if (simpleFabric.REACTIVE_SINGLE_TO_SINGLE && srcPrefix.prefixLength() > 0) {
+ if (REACTIVE_SINGLE_TO_SINGLE && srcPrefix.prefixLength() > 0) {
selector.matchIPv6Src(srcPrefix);
}
if (dstPrefix.prefixLength() > 0) {
selector.matchIPv6Dst(dstPrefix);
}
- if (ipProto != 0 && simpleFabric.REACTIVE_MATCH_IP_PROTO) {
+ if (ipProto != 0 && REACTIVE_MATCH_IP_PROTO) {
selector.matchIPProtocol(ipProto);
}
}
Key key;
String keyProtoTag = "";
- if (simpleFabric.REACTIVE_MATCH_IP_PROTO) {
+ if (REACTIVE_MATCH_IP_PROTO) {
keyProtoTag = "-p" + ipProto;
}
- if (simpleFabric.REACTIVE_SINGLE_TO_SINGLE) {
+ if (REACTIVE_SINGLE_TO_SINGLE) {
// allocate intent per (srcPrefix, dstPrefix)
key = Key.of(srcPrefix.toString() + "-to-" + dstPrefix.toString() + keyProtoTag, reactiveAppId);
} else {
@@ -878,19 +892,19 @@
private int reactivePriority(boolean isForward, boolean isDstLocalSubnet, int borderRoutePrefixLength) {
if (isDstLocalSubnet) { // -> dst:localSubnet
if (isForward) {
- return simpleFabric.PRI_REACTIVE_LOCAL_FORWARD;
+ return PRI_REACTIVE_LOCAL_FORWARD;
} else { // isInterncept
- return simpleFabric.PRI_REACTIVE_LOCAL_INTERCEPT;
+ return PRI_REACTIVE_LOCAL_INTERCEPT;
}
} else { // -> dst:boarderRouteNextHop
int offset;
if (isForward) {
- offset = simpleFabric.PRI_REACTIVE_BORDER_FORWARD;
+ offset = PRI_REACTIVE_BORDER_FORWARD;
} else { // isIntercept
- offset = simpleFabric.PRI_REACTIVE_BORDER_INTERCEPT;
+ offset = PRI_REACTIVE_BORDER_INTERCEPT;
}
- return simpleFabric.PRI_REACTIVE_BORDER_BASE
- + borderRoutePrefixLength * simpleFabric.PRI_REACTIVE_BORDER_STEP + offset;
+ return PRI_REACTIVE_BORDER_BASE
+ + borderRoutePrefixLength * PRI_REACTIVE_BORDER_STEP + offset;
}
}
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/package-info.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/package-info.java
new file mode 100644
index 0000000..d190b08
--- /dev/null
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Simple fabric implementation package.
+ */
+package org.onosproject.simplefabric.impl;
\ No newline at end of file
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/RouteTools.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/RouteTools.java
similarity index 94%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/RouteTools.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/RouteTools.java
index b14438a..d02fed2 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/RouteTools.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/RouteTools.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* to remove dependency on onos.incubator.routing services, since 2017-08-09.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.util;
import org.onlab.packet.IpPrefix;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/package-info.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/package-info.java
new file mode 100644
index 0000000..9b3dde3
--- /dev/null
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/util/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Simple fabric utility package.
+ */
+package org.onosproject.simplefabric.util;
\ No newline at end of file
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebApplication.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebApplication.java
similarity index 90%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebApplication.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebApplication.java
index d82de73..960b4df 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebApplication.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.web;
import org.onlab.rest.AbstractWebApplication;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebResource.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebResource.java
similarity index 96%
rename from apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebResource.java
rename to apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebResource.java
index 3274a3e..cc68d6b 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricWebResource.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/SimpleFabricWebResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.simplefabric;
+package org.onosproject.simplefabric.web;
import org.onosproject.rest.AbstractWebResource;
import org.onosproject.simplefabric.api.SimpleFabricService;
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/package-info.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/package-info.java
new file mode 100644
index 0000000..596ded0
--- /dev/null
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/web/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Simple fabric web package.
+ */
+package org.onosproject.simplefabric.web;
\ No newline at end of file