Disable host learning feature.
This patch gives us the ability to disable
host learning in certain ports via the ports
configuration.
We have the following cases :
- Discover a host with no learning configuration, this
results to learned host (missing config assumes learning is on)
- Discover a host with learning configuration set to false,
do not learn that host.
- Update the learning configuration of a CP to false. Then,
fetch all host at that location, if these hosts are not
configured statically at this location, remove them
Change-Id: I2a05ce5f9a890bb4049fd7856f95d78f467e3330
diff --git a/core/api/src/main/java/org/onosproject/net/config/basics/HostLearningConfig.java b/core/api/src/main/java/org/onosproject/net/config/basics/HostLearningConfig.java
new file mode 100644
index 0000000..7a4a5a4
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/config/basics/HostLearningConfig.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016-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.net.config.basics;
+
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.config.Config;
+
+/**
+ * Configuration for enabling/disabling host learning.
+ */
+public class HostLearningConfig extends Config<ConnectPoint> {
+ private static final String ENABLED = "enabled";
+
+ @Override
+ public boolean isValid() {
+ return isBoolean(ENABLED, FieldPresence.MANDATORY);
+ }
+
+ public Boolean hostLearningEnabled() {
+ return get(ENABLED, true);
+ }
+
+ public void setEnabled(String boolString) {
+ object.put(ENABLED, boolString);
+ }
+}