Use new property scheme for segment routing app
Change-Id: I0e8831ac69dfeef89e89034b75f26be66cea385d
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java
new file mode 100644
index 0000000..399e95b
--- /dev/null
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package org.onosproject.segmentrouting;
+
+/**
+ * Constants for default values of configurable properties.
+ */
+public final class OsgiPropertyConstants {
+
+ private OsgiPropertyConstants() {}
+
+ public static final String PROP_ACTIVE_PROBING = "activeProbing";
+ public static final boolean ACTIVE_PROBING_DEFAULT = true;
+
+ public static final String PROP_SINGLE_HOMED_DOWN = "singleHomedDown";
+ public static final boolean SINGLE_HOMED_DOWN_DEFAULT = false;
+
+ public static final String PROP_RESPOND_TO_UNKNOWN_HOSTS = "respondToUnknownHosts";
+ public static final boolean RESPOND_TO_UNKNOWN_HOSTS_DEFAULT = true;
+
+ public static final String PROP_ROUTE_DOUBLE_TAGGED_HOSTS = "routeDoubleTaggedHosts";
+ public static final boolean ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT = false;
+
+ public static final String PROP_DEFAULT_INTERNAL_VLAN = "defaultInternalVlan";
+ public static final int DEFAULT_INTERNAL_VLAN_DEFAULT = 4094;
+
+ public static final String PROP_PW_TRANSPORT_VLAN = "pwTransportVlan";
+ public static final int PW_TRANSPORT_VLAN_DEFAULT = 4090;
+
+}
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index e759020..a21e12b 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -157,11 +157,34 @@
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED;
import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.ACTIVE_PROBING_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.DEFAULT_INTERNAL_VLAN_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ACTIVE_PROBING;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_DEFAULT_INTERNAL_VLAN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_PW_TRANSPORT_VLAN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_RESPOND_TO_UNKNOWN_HOSTS;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_DOUBLE_TAGGED_HOSTS;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SINGLE_HOMED_DOWN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PW_TRANSPORT_VLAN_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.RESPOND_TO_UNKNOWN_HOSTS_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.SINGLE_HOMED_DOWN_DEFAULT;
/**
* Segment routing manager.
*/
-@Component(immediate = true, service = SegmentRoutingService.class)
+@Component(
+ immediate = true,
+ service = SegmentRoutingService.class,
+ property = {
+ PROP_ACTIVE_PROBING + ":Boolean=" + ACTIVE_PROBING_DEFAULT,
+ PROP_SINGLE_HOMED_DOWN + ":Boolean=" + SINGLE_HOMED_DOWN_DEFAULT,
+ PROP_RESPOND_TO_UNKNOWN_HOSTS + ":Boolean=" + RESPOND_TO_UNKNOWN_HOSTS_DEFAULT,
+ PROP_ROUTE_DOUBLE_TAGGED_HOSTS + ":Boolean=" + ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT,
+ PROP_DEFAULT_INTERNAL_VLAN + ":Integer=" + DEFAULT_INTERNAL_VLAN_DEFAULT,
+ PROP_PW_TRANSPORT_VLAN + ":Integer=" + PW_TRANSPORT_VLAN_DEFAULT,
+ }
+)
public class SegmentRoutingManager implements SegmentRoutingService {
private static Logger log = LoggerFactory.getLogger(SegmentRoutingManager.class);
@@ -230,32 +253,23 @@
@Reference(cardinality = ReferenceCardinality.OPTIONAL)
public XconnectService xconnectService;
- //@Property(name = "activeProbing", boolValue = true,
- // label = "Enable active probing to discover dual-homed hosts.")
- boolean activeProbing = true;
+ /** Enable active probing to discover dual-homed hosts. */
+ boolean activeProbing = ACTIVE_PROBING_DEFAULT;
- //@Property(name = "singleHomedDown", boolValue = false,
- // label = "Enable administratively taking down single-homed hosts "
- // + "when all uplinks are gone")
- boolean singleHomedDown = false;
+ /** Enable administratively taking down single-homed hosts. */
+ boolean singleHomedDown = SINGLE_HOMED_DOWN_DEFAULT;
- //@Property(name = "respondToUnknownHosts", boolValue = true,
- // label = "Enable this to respond to ARP/NDP requests from unknown hosts.")
- boolean respondToUnknownHosts = true;
+ /** Enable this to respond to ARP/NDP requests from unknown hosts. */
+ boolean respondToUnknownHosts = RESPOND_TO_UNKNOWN_HOSTS_DEFAULT;
- //@Property(name = "routeDoubleTaggedHosts", boolValue = false,
- // label = "Program flows and groups to pop and route double tagged hosts")
- boolean routeDoubleTaggedHosts = false;
+ /** Program flows and groups to pop and route double tagged hosts. */
+ boolean routeDoubleTaggedHosts = ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT;
- private static final int DEFAULT_INTERNAL_VLAN = 4094;
- //@Property(name = "defaultInternalVlan", intValue = DEFAULT_INTERNAL_VLAN,
- // label = "internal vlan assigned by default to unconfigured ports")
- private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN;
+ /** internal vlan assigned by default to unconfigured ports. */
+ private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN_DEFAULT;
- private static final int PW_TRANSPORT_VLAN = 4090;
- //@Property(name = "pwTransportVlan", intValue = PW_TRANSPORT_VLAN,
- // label = "vlan used for transport of pseudowires between switches")
- private int pwTransportVlan = PW_TRANSPORT_VLAN;
+ /** vlan used for transport of pseudowires between switches. */
+ private int pwTransportVlan = PW_TRANSPORT_VLAN_DEFAULT;
ArpHandler arpHandler = null;
IcmpHandler icmpHandler = null;