diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics')
9 files changed, 0 insertions, 884 deletions
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 |