summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/main/java/org/onosproject/net/config
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/config')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/Config.java475
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigApplyDelegate.java33
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigFactory.java122
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigOperator.java31
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java92
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigListener.java24
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigRegistry.java75
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java148
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStore.java132
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStoreDelegate.java24
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java87
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/AllowedEntityConfig.java49
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java90
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicElementConfig.java130
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicFeatureConfig.java54
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicHostConfig.java97
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicLinkConfig.java145
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java190
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java109
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/package-info.java20
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/package-info.java20
21 files changed, 0 insertions, 2147 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/Config.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/Config.java
deleted file mode 100644
index 5f2c9f3a..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/Config.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Function;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Base abstraction of a configuration facade for a specific subject. Derived
- * classes should keep all state in the specified JSON tree as that is the
- * only state that will be distributed or persisted; this class is merely
- * a facade for interacting with a particular facet of configuration on a
- * given subject.
- *
- * @param <S> type of subject
- */
-@Beta
-public abstract class Config<S> {
-
- protected S subject;
- protected String key;
-
- protected JsonNode node;
- protected ObjectNode object;
- protected ArrayNode array;
- protected ObjectMapper mapper;
-
- protected ConfigApplyDelegate delegate;
-
- /**
- * Indicator of whether a configuration JSON field is required.
- */
- public enum FieldPresence {
- /**
- * Signifies that config field is an optional one.
- */
- OPTIONAL,
-
- /**
- * Signifies that config field is mandatory.
- */
- MANDATORY
- }
-
- /**
- * Initializes the configuration behaviour with necessary context.
- *
- * @param subject configuration subject
- * @param key configuration key
- * @param node JSON node where configuration data is stored
- * @param mapper JSON object mapper
- * @param delegate delegate context
- */
- public void init(S subject, String key, JsonNode node, ObjectMapper mapper,
- ConfigApplyDelegate delegate) {
- this.subject = checkNotNull(subject);
- this.key = key;
- this.node = checkNotNull(node);
- this.object = node instanceof ObjectNode ? (ObjectNode) node : null;
- this.array = node instanceof ArrayNode ? (ArrayNode) node : null;
- this.mapper = checkNotNull(mapper);
- this.delegate = checkNotNull(delegate);
- }
-
- /**
- * Indicates whether or not the backing JSON node contains valid data.
- * <p>
- * Default implementation returns true.
- * Subclasses are expected to override this with their own validation.
- * </p>
- *
- * @return true if the data is valid; false otherwise
- */
- public boolean isValid() {
- // TODO: figure out what assertions could be made in the base class
- // NOTE: The thought is to have none, but instead to provide a set
- // of predicates to allow configs to test validity of present fields,
- // e.g.:
- // isString(path)
- // isBoolean(path)
- // isNumber(path, [min, max])
- // isDecimal(path, [min, max])
- // isMacAddress(path)
- // isIpAddress(path)
- return true;
- }
-
- /**
- * Returns the specific subject to which this configuration pertains.
- *
- * @return configuration subject
- */
- public S subject() {
- return subject;
- }
-
- /**
- * Returns the configuration key. This is primarily aimed for use in
- * composite JSON trees in external representations and has no bearing on
- * the internal behaviours.
- *
- * @return configuration key
- */
- public String key() {
- return key;
- }
-
- /**
- * Returns the JSON node that contains the configuration data.
- *
- * @return JSON node backing the configuration
- */
- public JsonNode node() {
- return node;
- }
-
- /**
- * Applies any configuration changes made via this configuration.
- */
- public void apply() {
- delegate.onApply(this);
- }
-
-
- // Miscellaneous helpers for interacting with JSON
-
- /**
- * Gets the specified property as a string.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @return property value or default value
- */
- protected String get(String name, String defaultValue) {
- return object.path(name).asText(defaultValue);
- }
-
- /**
- * Sets the specified property as a string or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @return self
- */
- protected Config<S> setOrClear(String name, String value) {
- if (value != null) {
- object.put(name, value);
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified property as a boolean.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @return property value or default value
- */
- protected boolean get(String name, boolean defaultValue) {
- return object.path(name).asBoolean(defaultValue);
- }
-
- /**
- * Sets the specified property as a boolean or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @return self
- */
- protected Config<S> setOrClear(String name, Boolean value) {
- if (value != null) {
- object.put(name, value.booleanValue());
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified property as an integer.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @return property value or default value
- */
- protected int get(String name, int defaultValue) {
- return object.path(name).asInt(defaultValue);
- }
-
- /**
- * Sets the specified property as an integer or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @return self
- */
- protected Config<S> setOrClear(String name, Integer value) {
- if (value != null) {
- object.put(name, value.intValue());
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified property as a long.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @return property value or default value
- */
- protected long get(String name, long defaultValue) {
- return object.path(name).asLong(defaultValue);
- }
-
- /**
- * Sets the specified property as a long or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @return self
- */
- protected Config<S> setOrClear(String name, Long value) {
- if (value != null) {
- object.put(name, value.longValue());
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified property as a double.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @return property value or default value
- */
- protected double get(String name, double defaultValue) {
- return object.path(name).asDouble(defaultValue);
- }
-
- /**
- * Sets the specified property as a double or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @return self
- */
- protected Config<S> setOrClear(String name, Double value) {
- if (value != null) {
- object.put(name, value.doubleValue());
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified property as an enum.
- *
- * @param name property name
- * @param defaultValue default value if property not set
- * @param enumClass the enum class
- * @param <E> type of enum
- * @return property value or default value
- */
- protected <E extends Enum<E>> E get(String name, E defaultValue, Class<E> enumClass) {
- return Enum.valueOf(enumClass, object.path(name).asText(defaultValue.toString()));
- }
-
- /**
- * Sets the specified property as a double or clears it if null value given.
- *
- * @param name property name
- * @param value new value or null to clear the property
- * @param <E> type of enum
- * @return self
- */
- protected <E extends Enum> Config<S> setOrClear(String name, E value) {
- if (value != null) {
- object.put(name, value.toString());
- } else {
- object.remove(name);
- }
- return this;
- }
-
- /**
- * Gets the specified array property as a list of items.
- *
- * @param name property name
- * @param function mapper from string to item
- * @param <T> type of item
- * @return list of items
- */
- protected <T> List<T> getList(String name, Function<String, T> function) {
- List<T> list = Lists.newArrayList();
- ArrayNode arrayNode = (ArrayNode) object.path(name);
- arrayNode.forEach(i -> list.add(function.apply(i.asText())));
- return list;
- }
-
- /**
- * Gets the specified array property as a list of items.
- *
- * @param name property name
- * @param function mapper from string to item
- * @param defaultValue default value if property not set
- * @param <T> type of item
- * @return list of items
- */
- protected <T> List<T> getList(String name, Function<String, T> function, List<T> defaultValue) {
- List<T> list = Lists.newArrayList();
- JsonNode jsonNode = object.path(name);
- if (jsonNode.isMissingNode()) {
- return defaultValue;
- }
- ArrayNode arrayNode = (ArrayNode) jsonNode;
- arrayNode.forEach(i -> list.add(function.apply(i.asText())));
- return list;
- }
-
- /**
- * Sets the specified property as an array of items in a given collection or
- * clears it if null is given.
- *
- * @param name propertyName
- * @param collection collection of items
- * @param <T> type of items
- * @return self
- */
- protected <T> Config<S> setOrClear(String name, Collection<T> collection) {
- if (collection == null) {
- object.remove(name);
- } else {
- ArrayNode arrayNode = mapper.createArrayNode();
- collection.forEach(i -> arrayNode.add(i.toString()));
- object.set(name, arrayNode);
- }
- return this;
- }
-
- /**
- * Indicates whether only the specified fields are present in the backing JSON.
- *
- * @param allowedFields allowed field names
- * @return true if all allowedFields are present; false otherwise
- */
- protected boolean hasOnlyFields(String... allowedFields) {
- Set<String> fields = ImmutableSet.copyOf(allowedFields);
- return !Iterators.any(object.fieldNames(), f -> !fields.contains(f));
- }
-
- /**
- * Indicates whether the specified field holds a valid MAC address.
- *
- * @param field JSON field name
- * @param presence specifies if field is optional or mandatory
- * @return true if valid; false otherwise
- * @throws IllegalArgumentException if field is present, but not valid MAC
- */
- protected boolean isMacAddress(String field, FieldPresence presence) {
- JsonNode node = object.path(field);
- return isValid(node, presence, node.isTextual() &&
- MacAddress.valueOf(node.asText()) != null);
- }
-
- /**
- * Indicates whether the specified field holds a valid IP address.
- *
- * @param field JSON field name
- * @param presence specifies if field is optional or mandatory
- * @return true if valid; false otherwise
- * @throws IllegalArgumentException if field is present, but not valid IP
- */
- protected boolean isIpAddress(String field, FieldPresence presence) {
- JsonNode node = object.path(field);
- return isValid(node, presence, node.isTextual() &&
- IpAddress.valueOf(node.asText()) != null);
- }
-
- /**
- * Indicates whether the specified field holds a valid string value.
- *
- * @param field JSON field name
- * @param presence specifies if field is optional or mandatory
- * @param pattern optional regex pattern
- * @return true if valid; false otherwise
- * @throws IllegalArgumentException if field is present, but not valid MAC
- */
- protected boolean isString(String field, FieldPresence presence, String... pattern) {
- JsonNode node = object.path(field);
- return isValid(node, presence, node.isTextual() &&
- (pattern.length > 0 && node.asText().matches(pattern[0]) || pattern.length < 1));
- }
-
- /**
- * Indicates whether the specified field holds a valid number.
- *
- * @param field JSON field name
- * @param presence specifies if field is optional or mandatory
- * @param minMax optional min/max values
- * @return true if valid; false otherwise
- * @throws IllegalArgumentException if field is present, but not valid
- */
- protected boolean isNumber(String field, FieldPresence presence, long... minMax) {
- JsonNode node = object.path(field);
- return isValid(node, presence, (node.isLong() || node.isInt()) &&
- (minMax.length > 0 && minMax[0] <= node.asLong() || minMax.length < 1) &&
- (minMax.length > 1 && minMax[1] > node.asLong() || minMax.length < 2));
- }
-
- /**
- * Indicates whether the specified field holds a valid decimal number.
- *
- * @param field JSON field name
- * @param presence specifies if field is optional or mandatory
- * @param minMax optional min/max values
- * @return true if valid; false otherwise
- * @throws IllegalArgumentException if field is present, but not valid
- */
- protected boolean isDecimal(String field, FieldPresence presence, double... minMax) {
- JsonNode node = object.path(field);
- return isValid(node, presence, (node.isDouble() || node.isFloat()) &&
- (minMax.length > 0 && minMax[0] <= node.asDouble() || minMax.length < 1) &&
- (minMax.length > 1 && minMax[1] > node.asDouble() || minMax.length < 2));
- }
-
- /**
- * Indicates whether the node is present and of correct value or not
- * mandatory and absent.
- *
- * @param node JSON node
- * @param presence specifies if field is optional or mandatory
- * @param correctValue true if the value is correct
- * @return true if the field is as expected
- */
- private boolean isValid(JsonNode node, FieldPresence presence, boolean correctValue) {
- boolean isMandatory = presence == FieldPresence.MANDATORY;
- return isMandatory && correctValue || !isMandatory && !node.isNull() || correctValue;
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigApplyDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigApplyDelegate.java
deleted file mode 100644
index 1160a097..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigApplyDelegate.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Delegate for notification when configuration changes have been applied.
- */
-@Beta
-public interface ConfigApplyDelegate {
-
- /**
- * Processes changes applied to the specified configuration.
- *
- * @param config changed configuration
- */
- void onApply(Config config);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigFactory.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigFactory.java
deleted file mode 100644
index 25a34025..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-
-import com.google.common.annotations.Beta;
-
-/**
- * Base abstract factory for creating configurations for the specified subject type.
- *
- * @param <S> type of subject
- * @param <C> type of configuration
- */
-@Beta
-public abstract class ConfigFactory<S, C extends Config<S>> {
-
- private final SubjectFactory<S> subjectFactory;
- private final Class<C> configClass;
- private final String configKey;
- private final boolean isList;
-
- /**
- * Creates a new configuration factory for the specified class of subjects
- * capable of generating the configurations of the specified class. The
- * subject and configuration class keys are used merely as keys for use in
- * composite JSON trees.
- *
- * @param subjectFactory subject factory
- * @param configClass configuration class
- * @param configKey configuration class key
- */
- protected ConfigFactory(SubjectFactory<S> subjectFactory,
- Class<C> configClass, String configKey) {
- this(subjectFactory, configClass, configKey, false);
- }
-
- /**
- * Creates a new configuration factory for the specified class of subjects
- * capable of generating the configurations of the specified class. The
- * subject and configuration class keys are used merely as keys for use in
- * composite JSON trees.
- * <p>
- * Note that configurations backed by JSON array are not easily extensible
- * at the top-level as they are inherently limited to holding an ordered
- * list of items.
- * </p>
- *
- * @param subjectFactory subject factory
- * @param configClass configuration class
- * @param configKey configuration class key
- * @param isList true to indicate backing by JSON array
- */
- protected ConfigFactory(SubjectFactory<S> subjectFactory,
- Class<C> configClass, String configKey,
- boolean isList) {
- this.subjectFactory = subjectFactory;
- this.configClass = configClass;
- this.configKey = configKey;
- this.isList = isList;
- }
-
- /**
- * Returns the class of the subject to which this factory applies.
- *
- * @return subject type
- */
- public SubjectFactory<S> subjectFactory() {
- return subjectFactory;
- }
-
- /**
- * Returns the class of the configuration which this factory generates.
- *
- * @return configuration type
- */
- public Class<C> configClass() {
- return configClass;
- }
-
- /**
- * Returns the unique key (within subject class) of this configuration.
- * This is primarily aimed for use in composite JSON trees in external
- * representations and has no bearing on the internal behaviours.
- *
- * @return configuration key
- */
- public String configKey() {
- return configKey;
- }
-
- /**
- * Creates a new but uninitialized configuration. Framework will initialize
- * the configuration via {@link Config#init} method.
- *
- * @return new uninitialized configuration
- */
- public abstract C createConfig();
-
- /**
- * Indicates whether the configuration is a list and should be backed by
- * a JSON array rather than JSON object.
- *
- * @return true if backed by JSON array
- */
- public boolean isList() {
- return isList;
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigOperator.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigOperator.java
deleted file mode 100644
index 505e8b3b..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/ConfigOperator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * 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;
-
-/**
- * An interface signifying a class that implements network configuration
- * information from multiple sources. There is a natural ordering to the
- * precedence of information, depending on its source:
- * <ol>
- * <li>Intents (from applications), which override</li>
- * <li>Configs (from the network configuration subsystem), which override</li>
- * <li>Descriptions (from southbound)</li>
- * </ol>
- * i.e., for a field representing the same attribute, the value from a Config
- * entity will be used over that from the Description.
- */
-public interface ConfigOperator {
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java
deleted file mode 100644
index ee9ceadf..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigEvent.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import org.onosproject.event.AbstractEvent;
-
-/**
- * Describes network configuration event.
- */
-public class NetworkConfigEvent extends AbstractEvent<NetworkConfigEvent.Type, Object> {
-
- private final Class configClass;
-
- /**
- * Type of network configuration events.
- */
- public enum Type {
- /**
- * Signifies that a network configuration was registered.
- */
- CONFIG_REGISTERED,
-
- /**
- * Signifies that a network configuration was unregistered.
- */
- CONFIG_UNREGISTERED,
-
- /**
- * Signifies that network configuration was added.
- */
- CONFIG_ADDED,
-
- /**
- * Signifies that network configuration was updated.
- */
- CONFIG_UPDATED,
-
- /**
- * Signifies that network configuration was removed.
- */
- CONFIG_REMOVED
- }
-
- /**
- * Creates an event of a given type and for the specified subject and the
- * current time.
- *
- * @param type event type
- * @param subject event subject
- * @param configClass configuration class
- */
- public NetworkConfigEvent(Type type, Object subject, Class configClass) {
- super(type, subject);
- this.configClass = configClass;
- }
-
- /**
- * Creates an event of a given type and for the specified subject and time.
- *
- * @param type device event type
- * @param subject event subject
- * @param configClass configuration class
- * @param time occurrence time
- */
- public NetworkConfigEvent(Type type, Object subject, Class configClass, long time) {
- super(type, subject, time);
- this.configClass = configClass;
- }
-
- /**
- * Returns the class of configuration that has been changed.
- *
- * @return configuration class
- */
- public Class configClass() {
- return configClass;
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigListener.java
deleted file mode 100644
index 73177755..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of receiving network configuration related events.
- */
-public interface NetworkConfigListener extends EventListener<NetworkConfigEvent> {
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigRegistry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigRegistry.java
deleted file mode 100644
index b4937d74..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigRegistry.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import com.google.common.annotations.Beta;
-
-import java.util.Set;
-
-/**
- * Service for tracking network configuration factories. It is the basis for
- * extensibility to allow various core subsystems or apps to register their
- * own configuration factories that permit use to inject additional meta
- * information about how various parts of the network should be viewed and
- * treated.
- */
-@Beta
-public interface NetworkConfigRegistry extends NetworkConfigService {
-
- /**
- * Registers the specified configuration factory.
- *
- * @param configFactory configuration factory
- */
- void registerConfigFactory(ConfigFactory configFactory);
-
- /**
- * Unregisters the specified configuration factory.
- *
- * @param configFactory configuration factory
- */
- void unregisterConfigFactory(ConfigFactory configFactory);
-
- /**
- * Returns set of all registered configuration factories.
- *
- * @return set of config factories
- */
- Set<ConfigFactory> getConfigFactories();
-
- /**
- * Returns set of all configuration factories registered for the specified
- * class of subject.
- *
- * @param subjectClass subject class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return set of config factories
- */
- <S, C extends Config<S>> Set<ConfigFactory<S, C>> getConfigFactories(Class<S> subjectClass);
-
- /**
- * Returns the configuration factory that produces the specified class of
- * configurations.
- *
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return config factory
- */
- <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
deleted file mode 100644
index f1b22c41..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.annotations.Beta;
-import org.onosproject.event.ListenerService;
-
-import java.util.Set;
-
-/**
- * Service for tracking network configurations which specify how the discovered
- * network information should be interpreted and how the core or applications
- * should act on or configure the network.
- */
-@Beta
-public interface NetworkConfigService
- extends ListenerService<NetworkConfigEvent, NetworkConfigListener> {
-
- /**
- * Returns the set of subject classes for which configuration may be
- * available.
- *
- * @return set of subject classes
- */
- Set<Class> getSubjectClasses();
-
- /**
- * Returns the subject factory with the specified key.
- *
- * @param subjectClassKey subject class key
- * @return subject class
- */
- SubjectFactory getSubjectFactory(String subjectClassKey);
-
- /**
- * Returns the subject factory for the specified class.
- *
- * @param subjectClass subject class
- * @return subject class factory
- */
- SubjectFactory getSubjectFactory(Class subjectClass);
-
- /**
- * Returns the configuration class with the specified key.
- *
- * @param subjectClassKey subject class key
- * @param configKey subject class name
- * @return subject class
- */
- Class<? extends Config> getConfigClass(String subjectClassKey, String configKey);
-
- /**
- * Returns the set of subjects for which some configuration is available.
- *
- * @param subjectClass subject class
- * @param <S> type of subject
- * @return set of configured subjects
- */
- <S> Set<S> getSubjects(Class<S> subjectClass);
-
- /**
- * Returns the set of subjects for which the specified configuration is
- * available.
- *
- * @param subjectClass subject class
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return set of configured subjects
- */
- <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass);
-
- /**
- * Returns all configurations for the specified subject.
- *
- * @param subject configuration subject
- * @param <S> type of subject
- * @return set of configurations
- */
- <S> Set<? extends Config<S>> getConfigs(S subject);
-
- /**
- * Returns the configuration for the specified subject and configuration
- * class if one is available; null otherwise.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration or null if one is not available
- */
- <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass);
-
- /**
- * Creates a new configuration for the specified subject and configuration
- * class. If one already exists, it is simply returned.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration or null if one is not available
- */
- <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass);
-
- /**
- * Applies configuration for the specified subject and configuration
- * class using the raw JSON node. If configuration already exists, it
- * will be updated.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param json raw JSON node containing the configuration data
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration or null if one is not available
- * @throws IllegalArgumentException if the supplied JSON node contains
- * invalid data
- */
- <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass,
- JsonNode json);
-
- /**
- * Clears any configuration for the specified subject and configuration
- * class. If one does not exist, this call has no effect.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- */
- <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStore.java
deleted file mode 100644
index 9be4b120..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStore.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onosproject.store.Store;
-
-import java.util.Set;
-
-/**
- * Mechanism for distributing and storing network configuration information.
- */
-public interface NetworkConfigStore extends Store<NetworkConfigEvent, NetworkConfigStoreDelegate> {
-
- /**
- * Adds a new configuration factory.
- *
- * @param configFactory configuration factory to add
- */
- void addConfigFactory(ConfigFactory configFactory);
-
- /**
- * Removes a configuration factory.
- *
- * @param configFactory configuration factory to remove
- */
- void removeConfigFactory(ConfigFactory configFactory);
-
- /**
- * Returns the configuration factory for the specified configuration class.
- *
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration factory or null
- */
- <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass);
-
- /**
- * Returns set of subjects of the specified class, which have some
- * network configuration associated with them.
- *
- * @param subjectClass subject class
- * @param <S> type of subject
- * @return set of subject
- */
- <S> Set<S> getSubjects(Class<S> subjectClass);
-
- /**
- * Returns set of subjects of the specified class, which have the
- * specified class of network configuration associated with them.
- *
- * @param subjectClass subject class
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return set of subject
- */
- <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass);
-
- /**
- * Returns set of configuration classes available for the specified subject.
- *
- * @param subject configuration subject
- * @param <S> type of subject
- * @return set of configuration classes
- */
- <S> Set<Class<? extends Config<S>>> getConfigClasses(S subject);
-
- /**
- * Get the configuration of the given class and for the specified subject.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration object
- */
- <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass);
-
- /**
- * Creates a new configuration of the given class for the specified subject.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration object
- */
- <S, C extends Config<S>> C createConfig(S subject, Class<C> configClass);
-
- /**
- * Applies configuration for the specified subject and configuration
- * class using the raw JSON object. If configuration already exists, it
- * will be updated.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param json raw JSON node containing the configuration data
- * @param <S> type of subject
- * @param <C> type of configuration
- * @return configuration object
- * @throws IllegalArgumentException if the supplied JSON node contains
- * invalid data
- */
- <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass,
- JsonNode json);
-
- /**
- * Clears the configuration of the given class for the specified subject.
- *
- * @param subject configuration subject
- * @param configClass configuration class
- * @param <S> type of subject
- * @param <C> type of configuration
- */
- <S, C extends Config<S>> void clearConfig(S subject, Class<C> configClass);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStoreDelegate.java
deleted file mode 100644
index 15d3d3e8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigStoreDelegate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-import org.onosproject.store.StoreDelegate;
-
-/**
- * Network configuration store delegate abstraction.
- */
-public interface NetworkConfigStoreDelegate extends StoreDelegate<NetworkConfigEvent> {
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java
deleted file mode 100644
index f992d727..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-
-import com.google.common.annotations.Beta;
-
-/**
- * Base abstract factory for creating configuration subjects from their
- * string key image.
- *
- * @param <S> subject class
- */
-@Beta
-public abstract class SubjectFactory<S> {
-
- private final Class<S> subjectClass;
- private final String subjectClassKey;
-
- /**
- * Creates a new configuration factory for the specified class of subjects
- * capable of generating the configurations of the specified class. The
- * subject and configuration class keys are used merely as keys for use in
- * composite JSON trees.
- *
- * @param subjectClass subject class
- * @param subjectClassKey subject class key
- */
- protected SubjectFactory(Class<S> subjectClass, String subjectClassKey) {
- this.subjectClass = subjectClass;
- this.subjectClassKey = subjectClassKey;
- }
-
- /**
- * Returns the class of the subject to which this factory applies.
- *
- * @return subject type
- */
- public Class<S> subjectClass() {
- return subjectClass;
- }
-
- /**
- * Returns the unique key of this configuration subject class.
- * This is primarily aimed for use in composite JSON trees in external
- * representations and has no bearing on the internal behaviours.
- *
- * @return configuration key
- */
- public String subjectClassKey() {
- return subjectClassKey;
- }
-
- /**
- * Returns the unique key of the specified configuration subject.
- * This is primarily aimed for use in composite JSON trees in external
- * representations and has no bearing on the internal behaviours.
- *
- * @param subject specific subject
- * @return subject key
- */
- public String subjectKey(S subject) {
- return subject.toString();
- }
-
- /**
- * Creates a configuration subject from its key image.
- *
- * @param subjectKey subject class key
- * @return configuration subject
- */
- public abstract S createSubject(String subjectKey);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/AllowedEntityConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/AllowedEntityConfig.java
deleted file mode 100644
index 6e6663c4..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/AllowedEntityConfig.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.config.Config;
-
-/**
- * Base abstraction for network entities for which admission into control
- * domain can be selectively configured, e.g. devices, end-stations, links
- */
-public abstract class AllowedEntityConfig<S> extends Config<S> {
-
- private static final String ALLOWED = "allowed";
-
- /**
- * Indicates whether the element is allowed for admission into the control
- * domain.
- *
- * @return true if element is allowed
- */
- public boolean isAllowed() {
- return get(ALLOWED, true);
- }
-
- /**
- * Specifies whether the element is to be allowed for admission into the
- * control domain.
- *
- * @param isAllowed true to allow; false to forbid; null to clear
- * @return self
- */
- public AllowedEntityConfig isAllowed(Boolean isAllowed) {
- return (AllowedEntityConfig) setOrClear(ALLOWED, isAllowed);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
deleted file mode 100644
index afde9a9e..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.Device;
-import org.onosproject.net.DeviceId;
-
-/**
- * Basic configuration for network infrastructure devices.
- */
-public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
-
- public static final String TYPE = "type";
- public static final String DRIVER = "driver";
- public static final String MANAGEMENT_ADDRESS = "managementAddress";
-
- /**
- * Returns the device type.
- *
- * @return device type override
- */
- public Device.Type type() {
- return get(TYPE, Device.Type.SWITCH, Device.Type.class);
- }
-
- /**
- * Sets the device type.
- *
- * @param type device type override
- * @return self
- */
- public BasicDeviceConfig type(Device.Type type) {
- return (BasicDeviceConfig) setOrClear(TYPE, type);
- }
-
- /**
- * Returns the device driver name.
- *
- * @return driver name of null if not set
- */
- public String driver() {
- return get(DRIVER, subject.toString());
- }
-
- /**
- * Sets the driver name.
- *
- * @param driverName new driver name; null to clear
- * @return self
- */
- public BasicElementConfig driver(String driverName) {
- return (BasicElementConfig) setOrClear(DRIVER, driverName);
- }
-
- /**
- * Returns the device management ip (ip:port).
- *
- * @return device management address (ip:port) or null if not set
- */
- public String managementAddress() {
- return get(MANAGEMENT_ADDRESS, null);
- }
-
- /**
- * Sets the driver name.
- *
- * @param managementAddress new device management address (ip:port); null to clear
- * @return self
- */
- public BasicElementConfig managementAddress(String managementAddress) {
- return (BasicElementConfig) setOrClear(MANAGEMENT_ADDRESS, managementAddress);
- }
-
- // TODO: device port meta-data to be configured via BasicPortsConfig
- // TODO: device credentials/keys
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicElementConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicElementConfig.java
deleted file mode 100644
index 7b3248c9..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicElementConfig.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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;
-
-/**
- * Basic configuration for network elements, e.g. devices, hosts. Such elements
- * can have a friendly name, geo-coordinates, logical rack coordinates and
- * an owner entity.
- */
-public abstract class BasicElementConfig<S> extends AllowedEntityConfig<S> {
-
- public static final String NAME = "name";
-
- public static final String LATITUDE = "latitude";
- public static final String LONGITUDE = "longitude";
-
- public static final String RACK_ADDRESS = "rackAddress";
- public static final String OWNER = "owner";
-
- protected static final double DEFAULT_COORD = -1.0;
-
- /**
- * Returns friendly label for the element.
- *
- * @return friendly label or element id itself if not set
- */
- public String name() {
- return get(NAME, subject.toString());
- }
-
- /**
- * Sets friendly label for the element.
- *
- * @param name new friendly label; null to clear
- * @return self
- */
- public BasicElementConfig name(String name) {
- return (BasicElementConfig) setOrClear(NAME, name);
- }
-
- /**
- * Returns element latitude.
- *
- * @return element latitude; -1 if not set
- */
- public double latitude() {
- return get(LATITUDE, DEFAULT_COORD);
- }
-
- /**
- * Sets the element latitude.
- *
- * @param latitude new latitude; null to clear
- * @return self
- */
- public BasicElementConfig latitude(Double latitude) {
- return (BasicElementConfig) setOrClear(LATITUDE, latitude);
- }
-
- /**
- * Returns element latitude.
- *
- * @return element latitude; -1 if not set
- */
- public double longitude() {
- return get(LONGITUDE, DEFAULT_COORD);
- }
-
- /**
- * Sets the element longitude.
- *
- * @param longitude new longitude; null to clear
- * @return self
- */
- public BasicElementConfig longitude(Double longitude) {
- return (BasicElementConfig) setOrClear(LONGITUDE, longitude);
- }
-
- /**
- * Returns the element rack address.
- *
- * @return rack address; null if not set
- */
- public String rackAddress() {
- return get(RACK_ADDRESS, null);
- }
-
- /**
- * Sets element rack address.
- *
- * @param address new rack address; null to clear
- * @return self
- */
- public BasicElementConfig rackAddress(String address) {
- return (BasicElementConfig) setOrClear(RACK_ADDRESS, address);
- }
-
- /**
- * Returns owner of the element.
- *
- * @return owner or null if not set
- */
- public String owner() {
- return get(OWNER, null);
- }
-
- /**
- * Sets the owner of the element.
- *
- * @param owner new owner; null to clear
- * @return self
- */
- public BasicElementConfig owner(String owner) {
- return (BasicElementConfig) setOrClear(OWNER, owner);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicFeatureConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicFeatureConfig.java
deleted file mode 100644
index fcf24bc6..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicFeatureConfig.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.config.Config;
-
-/**
- * Base abstraction for configuring feature on subject.
- *
- * @param <S> Subject type
- */
-public abstract class BasicFeatureConfig<S> extends Config<S> {
-
- private static final String ENABLED = "enabled";
-
- private final boolean defaultValue;
-
- protected BasicFeatureConfig(boolean defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * Indicates whether the feature for the subject is enabled.
- *
- * @return true if feature is enabled
- */
- public boolean enabled() {
- return get(ENABLED, defaultValue);
- }
-
- /**
- * Specifies whether the feature for the subject is to be enabled.
- *
- * @param enabled true to enable; false to disable; null to clear
- * @return self
- */
- public BasicFeatureConfig<S> enabled(Boolean enabled) {
- return (BasicFeatureConfig<S>) setOrClear(ENABLED, enabled);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicHostConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicHostConfig.java
deleted file mode 100644
index 92946312..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicHostConfig.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 com.fasterxml.jackson.databind.node.ArrayNode;
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.HostId;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Basic configuration for network end-station hosts.
- */
-public class BasicHostConfig extends BasicElementConfig<HostId> {
- private static final String IPS = "ips";
- private static final String LOCATION = "location";
-
- @Override
- public boolean isValid() {
- return hasOnlyFields(IPS, LOCATION) &&
- this.location() != null &&
- this.ipAddresses() != null;
- }
-
- /**
- * Gets location of the host.
- *
- * @return location of the host. Or null if not specified with correct format.
- */
- public ConnectPoint location() {
- String location = get(LOCATION, null);
-
- if (location != null) {
- try {
- return ConnectPoint.deviceConnectPoint(location);
- } catch (Exception e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Sets the location of the host.
- *
- * @param location location of the host.
- * @return the config of the host.
- */
- public BasicHostConfig setLocation(String location) {
- return (BasicHostConfig) setOrClear(LOCATION, location);
- }
-
- /**
- * Gets IP addresses of the host.
- *
- * @return IP addresses of the host. Or null if not specified with correct format.
- */
- public Set<IpAddress> ipAddresses() {
- HashSet<IpAddress> ipAddresses = new HashSet<>();
- if (object.has(IPS)) {
- ArrayNode ipNodes = (ArrayNode) object.path(IPS);
- try {
- ipNodes.forEach(ipNode -> {
- ipAddresses.add(IpAddress.valueOf(ipNode.asText()));
- });
- return ipAddresses;
- } catch (Exception e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Sets the IP addresses of the host.
- *
- * @param ipAddresses IP addresses of the host.
- * @return the config of the host.
- */
- public BasicHostConfig setIps(Set<IpAddress> ipAddresses) {
- return (BasicHostConfig) setOrClear(IPS, ipAddresses);
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicLinkConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicLinkConfig.java
deleted file mode 100644
index ed807b8f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicLinkConfig.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 com.fasterxml.jackson.databind.JsonNode;
-import org.onosproject.net.Link;
-import org.onosproject.net.LinkKey;
-
-import java.time.Duration;
-
-import static org.onosproject.net.config.Config.FieldPresence.OPTIONAL;
-
-/**
- * Basic configuration for network infrastructure link.
- */
-public class BasicLinkConfig extends AllowedEntityConfig<LinkKey> {
-
- public static final String TYPE = "type";
- public static final String METRIC = "metric";
- public static final String LATENCY = "latency";
- public static final String BANDWIDTH = "bandwidth";
- public static final String IS_DURABLE = "durable";
-
- @Override
- public boolean isValid() {
- return hasOnlyFields(TYPE, METRIC, LATENCY, BANDWIDTH, IS_DURABLE) &&
- isNumber(METRIC, OPTIONAL) && isNumber(LATENCY, OPTIONAL) &&
- isNumber(BANDWIDTH, OPTIONAL);
- }
-
- /**
- * Returns the link type.
- *
- * @return link type override
- */
- public Link.Type type() {
- return get(TYPE, Link.Type.DIRECT, Link.Type.class);
- }
-
- /**
- * Sets the link type.
- *
- * @param type link type override
- * @return self
- */
- public BasicLinkConfig type(Link.Type type) {
- return (BasicLinkConfig) setOrClear(TYPE, type);
- }
-
- /**
- * Returns link metric value for use by
- * {@link org.onosproject.net.topology.MetricLinkWeight} function.
- *
- * @return link metric; -1 if not set
- */
- public double metric() {
- return get(METRIC, -1);
- }
-
- /**
- * Sets the link metric for use by
- * {@link org.onosproject.net.topology.MetricLinkWeight} function.
- *
- * @param metric new metric; null to clear
- * @return self
- */
- public BasicLinkConfig metric(Double metric) {
- return (BasicLinkConfig) setOrClear(METRIC, metric);
- }
-
- /**
- * Returns link latency in terms of nanos.
- *
- * @return link latency; -1 if not set
- */
- public Duration latency() {
- return Duration.ofNanos(get(LATENCY, -1));
- }
-
- /**
- * Sets the link latency.
- *
- * @param latency new latency; null to clear
- * @return self
- */
- public BasicLinkConfig latency(Duration latency) {
- Long nanos = latency == null ? null : latency.toNanos();
- return (BasicLinkConfig) setOrClear(LATENCY, nanos);
- }
-
- /**
- * Returns link bandwidth in terms of Mbps.
- *
- * @return link bandwidth; -1 if not set
- */
- public long bandwidth() {
- return get(BANDWIDTH, -1);
- }
-
- /**
- * Sets the link bandwidth.
- *
- * @param bandwidth new bandwidth; null to clear
- * @return self
- */
- public BasicLinkConfig bandwidth(Long bandwidth) {
- return (BasicLinkConfig) setOrClear(BANDWIDTH, bandwidth);
- }
-
- /**
- * Returns if link is durable in the network model or not.
- *
- * @return true for durable, false otherwise
- */
- public Boolean isDurable() {
- JsonNode res = object.path(IS_DURABLE);
- if (res.isMissingNode()) {
- return null;
- }
- return res.asBoolean();
- }
-
- /**
- * Sets durability for this link.
- *
- * @param isDurable true for durable, false otherwise
- * @return this BasicLinkConfig
- */
- public BasicLinkConfig isDurable(Boolean isDurable) {
- return (BasicLinkConfig) setOrClear(IS_DURABLE, isDurable);
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java
deleted file mode 100644
index dfb494d6..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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 java.util.Optional;
-
-import org.onosproject.net.config.Config;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.Port;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-
-/**
- * Configurations for an optical port on a device.
- */
-public class OpticalPortConfig extends Config<ConnectPoint> {
- // optical type {OMS, OCH, ODUClt, fiber}
- public static final String TYPE = "type";
-
- // port name. "name" is the alphanumeric name of the port, but "port" refers
- // to the port number used as a name string (i.e., for ports without
- // alphanumeric names).
- public static final String NAME = "name";
- public static final String PORT = "port";
- public static final String STATIC_PORT = "staticPort";
- public static final String STATIC_LAMBDA = "staticLambda";
-
- // **Linc-OE : remove if it's not needed after all.**
- public static final String SPEED = "speed";
-
- /**
- * Returns the Enum value representing the type of port.
- *
- * @return the port type, or null if invalid or unset
- */
- public Port.Type type() {
- JsonNode type = object.path(TYPE);
- if (type.isMissingNode()) {
- return null;
- }
- return Port.Type.valueOf(type.asText());
- }
-
- /**
- * Returns the port name associated with this port configuration. The Name
- * is an alphanumeric string.
- *
- * @return the name of this port, else, an empty string
- */
- public String name() {
- return getStringValue(NAME);
- }
-
- /**
- * Returns a stringified representation of the port number, configured in
- * some port types without an alphanumeric name as the port name.
- *
- * @return A string representation of the port number
- */
- public String numberName() {
- return getStringValue(PORT);
- }
-
- /**
- * Returns the string-representation of name of the output port. This is
- * usually an OMS port for an OCH input ports, or an OCH port for ODU input
- * ports.
- *
- * @return the name of this port, else, an empty string
- */
- public String staticPort() {
- return getStringValue(STATIC_PORT);
- }
-
- private String getStringValue(String field) {
- JsonNode name = object.path(field);
- return name.isMissingNode() ? "" : name.asText();
- }
-
- /**
- * Returns the output lambda configured for this port. The lambda value is
- * expressed as a frequency value. If the port type doesn't have a notion of
- * lambdas, this returns an empty Optional.
- *
- * @return an Optional that may contain a frequency value.
- */
- public Optional<Long> staticLambda() {
- JsonNode sl = object.path(STATIC_LAMBDA);
- if (sl.isMissingNode()) {
- return Optional.empty();
- }
- return Optional.of(sl.asLong());
- }
-
- /**
- * Returns the port speed configured for this port. If the port doesn't have
- * a notion of speed, this returns an empty Optional.
- *
- * @return a port speed value whose default is 0.
- */
- public Optional<Integer> speed() {
- JsonNode s = object.path(SPEED);
- if (s.isMissingNode()) {
- return Optional.empty();
- }
- return Optional.of(s.asInt());
- }
-
- /**
- * Sets the port type, or updates it if it's already set. A null argument removes
- * this field.
- *
- * @param type the port type
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig portType(Port.Type type) {
- // if unspecified, ideally fall back on FIBER or PACKET.
- String pt = (type == null) ? null : type.toString();
- return (OpticalPortConfig) setOrClear(TYPE, pt);
- }
-
- /**
- * Sets the port name, or updates it if already set. A null argument removes
- * this field.
- *
- * @param name the port's name
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig portName(String name) {
- return (OpticalPortConfig) setOrClear(NAME, name);
- }
-
- /**
- * Sets the port name from port number, or updates it if already set. A null
- * argument removes this field.
- *
- * @param name the port number, to be used as name
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig portNumberName(Long name) {
- return (OpticalPortConfig) setOrClear(PORT, name);
- }
-
- /**
- * Sets the output port name, or updates it if already set. A null argument
- * removes this field.
- *
- * @param name the output port's name
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig staticPort(String name) {
- return (OpticalPortConfig) setOrClear(STATIC_PORT, name);
- }
-
- /**
- * Sets the output lambda index, or updates it if already set. A null argument
- * removes this field.
- *
- * @param index the output lambda
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig staticLambda(Long index) {
- return (OpticalPortConfig) setOrClear(STATIC_LAMBDA, index);
- }
-
- /**
- * Sets the port speed, or updates it if already set. A null argument
- * removes this field.
- *
- * @param bw the port bandwidth
- * @return this OpticalPortConfig instance
- */
- public OpticalPortConfig speed(Integer bw) {
- return (OpticalPortConfig) setOrClear(SPEED, bw);
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java
deleted file mode 100644
index 311566b3..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
-import org.onosproject.net.LinkKey;
-import org.onosproject.net.config.SubjectFactory;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-/**
- * Set of subject factories for potential configuration subjects.
- */
-public final class SubjectFactories {
-
- // Construction forbidden
- private SubjectFactories() {
- }
-
- // Required for resolving application identifiers
- private static CoreService coreService;
-
- public static final SubjectFactory<ApplicationId> APP_SUBJECT_FACTORY =
- new SubjectFactory<ApplicationId>(ApplicationId.class, "apps") {
- @Override
- public ApplicationId createSubject(String key) {
- return coreService.registerApplication(key);
- }
- @Override
- public String subjectKey(ApplicationId subject) {
- return subject.name();
- }
- };
-
- public static final SubjectFactory<DeviceId> DEVICE_SUBJECT_FACTORY =
- new SubjectFactory<DeviceId>(DeviceId.class, "devices") {
- @Override
- public DeviceId createSubject(String key) {
- return DeviceId.deviceId(key);
- }
- };
-
- public static final SubjectFactory<ConnectPoint> CONNECT_POINT_SUBJECT_FACTORY =
- new SubjectFactory<ConnectPoint>(ConnectPoint.class, "ports") {
- @Override
- public ConnectPoint createSubject(String key) {
- return ConnectPoint.deviceConnectPoint(key);
- }
- @Override
- public String subjectKey(ConnectPoint subject) {
- return key(subject);
- }
- };
-
- public static final SubjectFactory<HostId> HOST_SUBJECT_FACTORY =
- new SubjectFactory<HostId>(HostId.class, "hosts") {
- @Override
- public HostId createSubject(String key) {
- return HostId.hostId(key);
- }
- };
-
- public static final SubjectFactory<LinkKey> LINK_SUBJECT_FACTORY =
- new SubjectFactory<LinkKey>(LinkKey.class, "links") {
- @Override
- public LinkKey createSubject(String key) {
- String[] cps = key.split("-");
- checkArgument(cps.length == 2, "Incorrect link key format: %s", key);
- return LinkKey.linkKey(ConnectPoint.deviceConnectPoint(cps[0]),
- ConnectPoint.deviceConnectPoint(cps[1]));
- }
- @Override
- public String subjectKey(LinkKey subject) {
- return key(subject.src()) + "-" + key(subject.dst());
- }
- };
-
- /**
- * Provides reference to the core service, which is required for
- * application subject factory.
- *
- * @param service core service reference
- */
- public static void setCoreService(CoreService service) {
- coreService = service;
- }
-
- private static String key(ConnectPoint subject) {
- return subject.deviceId() + "/" + subject.port();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/package-info.java
deleted file mode 100644
index 4d0f27e9..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.
- */
-
-/**
- * Various basic builtin network configurations.
- */
-package org.onosproject.net.config.basics; \ No newline at end of file
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/package-info.java
deleted file mode 100644
index f300717a..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.
- */
-
-/**
- * Subsystem for tracking network environment configuration.
- */
-package org.onosproject.net.config;