body) {
- return new TestYangRuntimeService() {
- @Override
- public CompositeStream encode(CompositeData internal,
- RuntimeContext context) {
- return body.apply(internal, context);
- }
- };
- }
-
- private abstract class TestYangRuntimeService implements YangRuntimeService {
-
- @Override
- public CompositeStream encode(CompositeData internal,
- RuntimeContext context) {
- fail("stub not implemented");
- return null;
- }
- @Override
- public CompositeData decode(CompositeStream external,
- RuntimeContext context) {
- fail("stub not implemented");
- return null;
- }
- }
-
- private final class TestNetconfContext implements NetconfContext {
- @Override
- public DeviceConfigSynchronizationProviderService providerService() {
- fail("Add stub driver as necessary");
- return null;
- }
-
- @Override
- public SchemaContextProvider schemaContextProvider() {
- fail("Add stub driver as necessary");
- return null;
- }
-
- @Override
- public YangRuntimeService yangRuntime() {
- return testYangRuntime;
- }
-
- @Override
- public NetconfController netconfController() {
- fail("Add stub driver as necessary");
- return null;
- }
- }
-
-}
diff --git a/apps/configsync/BUILD b/apps/configsync/BUILD
deleted file mode 100644
index 38b4fe717c..0000000000
--- a/apps/configsync/BUILD
+++ /dev/null
@@ -1,20 +0,0 @@
-APPS = [
- # dynamic config
- "org.onosproject.config",
-]
-
-COMPILE_DEPS = CORE_DEPS + ONOS_YANG + [
- "//apps/config:onos-apps-config",
-]
-
-osgi_jar_with_tests(
- deps = COMPILE_DEPS,
-)
-
-onos_app(
- category = "Utility",
- description = "Application to support the Dynamic configuration service.",
- required_apps = APPS,
- title = "Dynamic Configuration Synchronizer",
- url = "http://onosproject.org",
-)
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProvider.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProvider.java
deleted file mode 100644
index eed008f0eb..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.onosproject.d.config.sync.operation.SetRequest;
-import org.onosproject.d.config.sync.operation.SetResponse;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.provider.Provider;
-
-import com.google.common.annotations.Beta;
-
-// TODO might want to remove Device~ prefix, class name too long.
-/**
- * Abstraction of a device config synchronization provider.
- *
- * Provides a mean for propagating dynamic config triggered change down to
- * the device.
- */
-@Beta
-public interface DeviceConfigSynchronizationProvider extends Provider {
-
- // TODO API to propagate dynamic config subsystem side change down to the
- // device
-
- /**
- * Requests a device to set configuration as specified.
- *
- * @param deviceId target Device identifier
- * @param request configuration requests
- * @return result
- */
- CompletableFuture setConfiguration(DeviceId deviceId, SetRequest request);
-
- // TODO API for Get from Device
- // CompletableFuture getConfiguration(DeviceId deviceId, GetRequest request);
-
-}
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderRegistry.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderRegistry.java
deleted file mode 100644
index edf1eba5e0..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderRegistry.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync;
-
-import org.onosproject.net.provider.ProviderRegistry;
-
-/**
- * Abstraction of a device config synchronization provider registry.
- */
-public interface DeviceConfigSynchronizationProviderRegistry
- extends ProviderRegistry {
-
-}
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderService.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderService.java
deleted file mode 100644
index 8fa0ee33a9..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/DeviceConfigSynchronizationProviderService.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync;
-
-import org.onosproject.net.provider.ProviderService;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Service which configuration synchronization provider can interact
- * with the service.
- *
- * Provides a mean to propagate device triggered change event upward to
- * dynamic config subsystem.
- */
-@Beta
-public interface DeviceConfigSynchronizationProviderService
- extends ProviderService {
-
- // TODO API to propagate device detected change upwards
- // e.g., in reaction to NETCONF async notification,
- // report polling result up to DynConfig subsystem
-}
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java
deleted file mode 100644
index 1236364452..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizer.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync.impl;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import org.onlab.util.Tools;
-import org.onosproject.config.DynamicConfigEvent;
-import org.onosproject.config.DynamicConfigEvent.Type;
-import org.onosproject.config.DynamicConfigListener;
-import org.onosproject.config.DynamicConfigService;
-import org.onosproject.config.Filter;
-import org.onosproject.d.config.DataNodes;
-import org.onosproject.d.config.DeviceResourceIds;
-import org.onosproject.d.config.ResourceIds;
-import org.onosproject.d.config.sync.DeviceConfigSynchronizationProvider;
-import org.onosproject.d.config.sync.DeviceConfigSynchronizationProviderRegistry;
-import org.onosproject.d.config.sync.DeviceConfigSynchronizationProviderService;
-import org.onosproject.d.config.sync.operation.SetRequest;
-import org.onosproject.d.config.sync.operation.SetResponse;
-import org.onosproject.d.config.sync.operation.SetResponse.Code;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.provider.AbstractProviderRegistry;
-import org.onosproject.net.provider.AbstractProviderService;
-import org.onosproject.store.primitives.TransactionId;
-import org.onosproject.yang.model.DataNode;
-import org.onosproject.yang.model.ResourceId;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-
-import java.time.Duration;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.stream.Collectors;
-
-import static java.util.concurrent.CompletableFuture.completedFuture;
-import static org.onosproject.d.config.DeviceResourceIds.isUnderDeviceRootNode;
-import static org.onosproject.d.config.DeviceResourceIds.toDeviceId;
-import static org.onosproject.d.config.DeviceResourceIds.toResourceId;
-import static org.onosproject.d.config.sync.operation.SetResponse.response;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Component to bridge Dynamic Config store and the Device configuration state.
- *
- *
- * - Propagate DynamicConfig service change downward to Device side via provider.
- *
- Propagate Device triggered change event upward to DyamicConfig service.
- *
- */
-@Beta
-@Component(immediate = true, service = DeviceConfigSynchronizationProviderRegistry.class)
-public class DynamicDeviceConfigSynchronizer
- extends AbstractProviderRegistry
- implements DeviceConfigSynchronizationProviderRegistry {
-
- private static final Logger log = getLogger(DynamicDeviceConfigSynchronizer.class);
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected DynamicConfigService dynConfigService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected NetworkConfigService netcfgService;
-
- private DynamicConfigListener listener = new InnerDyConListener();
-
- // FIXME hack for unconsolidated event bug
- private Duration quietPeriod = Duration.ofSeconds(2);
- private long quietUntil = 0;
-
- @Activate
- public void activate() {
- // TODO start background task to sync Controller and Device?
- dynConfigService.addListener(listener);
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- dynConfigService.removeListener(listener);
- log.info("Stopped");
- }
-
-
- @Override
- protected DeviceConfigSynchronizationProviderService createProviderService(
- DeviceConfigSynchronizationProvider provider) {
- return new InternalConfigSynchronizationServiceProvider(provider);
- }
-
- @Override
- protected DeviceConfigSynchronizationProvider defaultProvider() {
- // TODO return provider instance which can deal with "general" provider?
- return super.defaultProvider();
- }
-
- /**
- * Proxy to relay Device change event for propagating running "state"
- * information up to dynamic configuration service.
- */
- class InternalConfigSynchronizationServiceProvider
- extends AbstractProviderService
- implements DeviceConfigSynchronizationProviderService {
-
- protected InternalConfigSynchronizationServiceProvider(DeviceConfigSynchronizationProvider provider) {
- super(provider);
- }
-
- // TODO API for passive information propagation to be added later on
- }
-
- /**
- * DynamicConfigListener to trigger active synchronization toward the device.
- */
- class InnerDyConListener implements DynamicConfigListener {
-
- @Override
- public boolean isRelevant(DynamicConfigEvent event) {
- // TODO NetconfActiveComponent.isRelevant(DynamicConfigEvent)
- // seems to be doing some filtering
- // Logic filtering for L3VPN is probably a demo hack,
- // but is there any portion of it which is really needed?
- // e.g., listen only for device tree events?
-
- ResourceId path = event.subject();
- // TODO only device tree related event is relevant.
- // 1) path is under device tree
- // 2) path is root, and DataNode contains element under node
- // ...
- return true;
- }
-
- @Override
- public void event(DynamicConfigEvent event) {
- // Note: removed accumulator in the old code assuming,
- // event accumulation will happen on Device Config Event level.
-
- // TODO execute off event dispatch thread
- processEventNonBatch(event);
- }
-
- }
-
- void processEventNonBatch(DynamicConfigEvent event) {
- if (System.currentTimeMillis() < quietUntil) {
- log.trace("Ignoring {}. Quiet period until {}",
- event, Tools.defaultOffsetDataTime(quietUntil));
- return;
- }
-
- ResourceId path = event.subject();
- if (isUnderDeviceRootNode(path)) {
- log.trace("processing event:{}", event);
-
- DeviceId deviceId = DeviceResourceIds.toDeviceId(path);
- ResourceId deviceRootPath = DeviceResourceIds.toResourceId(deviceId);
-
- ResourceId absPath = ResourceIds.concat(ResourceIds.ROOT_ID, path);
- ResourceId relPath = ResourceIds.relativize(deviceRootPath, absPath);
- // give me everything Filter
- Filter giveMeEverything = Filter.builder().build();
-
- DataNode node = dynConfigService.readNode(path, giveMeEverything);
- SetRequest request;
- switch (event.type()) {
-
- case NODE_ADDED:
- case NODE_REPLACED:
- request = SetRequest.builder().replace(relPath, node).build();
- break;
- case NODE_UPDATED:
- // Event has no pay load, only thing we can do is replace.
- request = SetRequest.builder().replace(relPath, node).build();
- break;
- case NODE_DELETED:
- request = SetRequest.builder().delete(relPath).build();
- break;
- case UNKNOWN_OPRN:
- default:
- log.error("Unexpected event {}, aborting", event);
- return;
- }
-
- log.info("Dispatching {} request {}", deviceId, request);
- CompletableFuture response = dispatchRequest(deviceId, request);
- response.whenComplete((resp, e) -> {
- if (e == null) {
- if (resp.code() == Code.OK) {
- log.info("{} for {} complete", resp, deviceId);
- } else {
- log.warn("{} for {} had problem", resp, deviceId);
- }
- } else {
- log.error("Request to {} failed {}", deviceId, response, e);
- }
- });
-
- // FIXME hack for unconsolidated event bug
- quietUntil = System.currentTimeMillis() + quietPeriod.toMillis();
- } else {
- log.debug("Ignored event's ResourceId: {}", event.subject());
- }
- }
-
-
- // was sketch to handle case, where event could contain batch of things...
- private void processEvent(DynamicConfigEvent event) {
- // TODO assuming event object will contain batch of (atomic) change event
-
- // What the new event will contain:
- Type evtType = event.type();
-
- // Transaction ID, can be null
- TransactionId txId = null;
-
- // TODO this might change into collection of (path, val_before, val_after)
-
- ResourceId path = event.subject();
- // data node (can be tree) representing change, it could be incremental update
- DataNode val = null;
-
- // build per-Device SetRequest
- // val could be a tree, containing multiple Device tree,
- // break them down into per-Device sub-tree
- Map requests = new HashMap<>();
-
- if (isUnderDeviceRootNode(path)) {
- // about single device
- buildDeviceRequest(requests, evtType, path, toDeviceId(path), val);
-
- } else if (DeviceResourceIds.isRootOrDevicesNode(path)) {
- // => potentially contain changes spanning multiple Devices
- Map perDevices = perDevices(path, val);
-
- perDevices.forEach((did, dataNode) -> {
- buildDeviceRequest(requests, evtType, toResourceId(did), did, dataNode);
- });
-
- // TODO special care is probably required for delete cases
- // especially delete all under devices
-
- } else {
- log.warn("Event not related to a Device?");
- }
-
-
- // TODO assuming event is a batch,
- // potentially containing changes for multiple devices,
- // who will process/coordinate the batch event?
-
-
- // TODO loop through per-Device change set
- List> responses =
- requests.entrySet().stream()
- .map(entry -> dispatchRequest(entry.getKey(), entry.getValue().build()))
- .collect(Collectors.toList());
-
- // wait for all responses
- List allResults = Tools.allOf(responses).join();
- // TODO deal with partial failure case (multi-device coordination)
- log.info("DEBUG: results: {}", allResults);
- }
-
- // might make sense to make this public
- CompletableFuture dispatchRequest(DeviceId devId, SetRequest req) {
-
- // determine appropriate provider for this Device
- DeviceConfigSynchronizationProvider provider = this.getProvider(devId);
-
- if (provider == null) {
- // no appropriate provider found
- // return completed future with failed SetResponse
- return completedFuture(response(req,
- SetResponse.Code.FAILED_PRECONDITION,
- "no provider found for " + devId));
- }
-
- // dispatch request
- return provider.setConfiguration(devId, req)
- .handle((resp, err) -> {
- if (err == null) {
- // set complete
- log.info("DEBUG: Req:{}, Resp:{}", req, resp);
- return resp;
- } else {
- // fatal error
- log.error("Fatal error on {}", req, err);
- return response(req,
- SetResponse.Code.UNKNOWN,
- "Unknown error " + err);
- }
- });
- }
-
-
- // may eventually reuse with batch event
- /**
- * Build device request about a Device.
- *
- * @param requests map containing request builder to populate
- * @param evtType change request type
- * @param path to {@code val}
- * @param did DeviceId which {@code path} is about
- * @param val changed node to write
- */
- private void buildDeviceRequest(Map requests,
- Type evtType,
- ResourceId path,
- DeviceId did,
- DataNode val) {
-
- SetRequest.Builder request =
- requests.computeIfAbsent(did, d -> SetRequest.builder());
-
- switch (evtType) {
- case NODE_ADDED:
- case NODE_REPLACED:
- request.replace(path, val);
- break;
-
- case NODE_UPDATED:
- // TODO Auto-generated method stub
- request.update(path, val);
- break;
-
- case NODE_DELETED:
- // TODO Auto-generated method stub
- request.delete(path);
- break;
-
- case UNKNOWN_OPRN:
- default:
- log.warn("Ignoring unexpected {}", evtType);
- break;
- }
- }
-
- /**
- * Breaks down tree {@code val} into per Device subtree.
- *
- * @param path pointing to {@code val}
- * @param val tree which contains only 1 Device.
- * @return Device node relative DataNode for each DeviceId
- * @throws IllegalArgumentException
- */
- private static Map perDevices(ResourceId path, DataNode val) {
- if (DeviceResourceIds.isUnderDeviceRootNode(path)) {
- // - if path is device root or it's subtree, path alone is sufficient
- return ImmutableMap.of(DeviceResourceIds.toDeviceId(path), val);
-
- } else if (DeviceResourceIds.isRootOrDevicesNode(path)) {
- // - if path is "/" or devices, it might be constructible from val tree
- final Collection devicesChildren;
- if (DeviceResourceIds.isRootNode(path)) {
- // root
- devicesChildren = DataNodes.childOnlyByName(val, DeviceResourceIds.DEVICES_NAME)
- .map(dn -> DataNodes.children(dn))
- .orElse(ImmutableList.of());
- } else {
- // devices
- devicesChildren = DataNodes.children(val);
- }
-
- return devicesChildren.stream()
- // TODO use full schemaId for filtering when ready
- .filter(dn -> dn.key().schemaId().name().equals(DeviceResourceIds.DEVICE_NAME))
- .collect(Collectors.toMap(dn -> DeviceResourceIds.toDeviceId(dn.key()),
- dn -> dn));
-
- }
- throw new IllegalArgumentException(path + " not related to Device");
- }
-
-}
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/package-info.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/package-info.java
deleted file mode 100644
index 23fa20152f..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/impl/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Implementation of dynamic config synchronizer.
- */
-package org.onosproject.d.config.sync.impl;
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetRequest.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetRequest.java
deleted file mode 100644
index d4d3254e69..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetRequest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync.operation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Objects;
-import java.util.Optional;
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.onosproject.d.config.sync.operation.SetRequest.Change.Operation;
-import org.onosproject.yang.model.DataNode;
-import org.onosproject.yang.model.ResourceId;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-
-// One SetRequest is expected to be a transaction, all-or-nothing
-/**
- * Collection of changes about a single Device,
- * intended to be applied to the Device transactionally.
- */
-@Beta
-public final class SetRequest {
-
- private final Collection changes;
-
- SetRequest(Collection changes) {
- this.changes = ImmutableList.copyOf(changes);
- }
-
- public Collection changes() {
- return changes;
- }
-
- public Collection> subjects() {
- return changes.stream()
- .map(c -> Pair.of(c.op(), c.path()))
- .collect(ImmutableList.toImmutableList());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SetRequest) {
- SetRequest that = (SetRequest) obj;
- return Objects.equals(this.changes, that.changes);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(changes);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("changes", changes)
- .toString();
- }
- public static SetRequest.Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private final List changes = new ArrayList<>();
-
- /**
- * Returns changes contained in this builder.
- *
- * @return unmodifiable list view of Changes
- */
- public List changes() {
- return Collections.unmodifiableList(changes);
- }
-
- /**
- * Adds request to remove specified {@code path}.
- *
- * @param path resource path relative to device root node
- * @return self
- */
- public SetRequest.Builder delete(ResourceId path) {
- changes.add(Change.delete(path));
- return this;
- }
-
- /**
- * Adds request to replace specified {@code path} with specified {@code val}.
- *
- * @param path resource path relative to device root node
- * @param val resource value
- * @return self
- */
- public SetRequest.Builder replace(ResourceId path, DataNode val) {
- changes.add(Change.replace(path, val));
- return this;
- }
-
- /**
- * Adds request to update/merge specified {@code val} to the {@code path}.
- *
- * @param path resource path relative to device root node
- * @param val resource value
- * @return self
- */
- public SetRequest.Builder update(ResourceId path, DataNode val) {
- changes.add(Change.update(path, val));
- return this;
- }
-
- public SetRequest build() {
- return new SetRequest(changes);
- }
- }
-
- public static final class Change {
-
- public enum Operation {
-
- // Note: equivalent to remove in netconf
- /**
- * Request to delete specified {@code path}.
- * If path does not exist, it is silently ignored.
- */
- DELETE,
- // Note: equivalent to replace in netconf
- /**
- * Request to replace specified {@code path} with specified {@code val}.
- */
- REPLACE,
- // Note: equivalent to merge in netconf
- /**
- * Request to update/merge specified {@code val} to the {@code path}.
- */
- UPDATE
- }
-
- private final Operation op;
- private final ResourceId path;
- private final Optional val;
-
- public static Change delete(ResourceId path) {
- return new Change(Operation.DELETE, path, Optional.empty());
- }
-
- public static Change replace(ResourceId path, DataNode val) {
- return new Change(Operation.REPLACE, path, Optional.of(val));
- }
-
- public static Change update(ResourceId path, DataNode val) {
- return new Change(Operation.UPDATE, path, Optional.of(val));
- }
-
- Change(Operation op, ResourceId path, Optional val) {
- this.op = checkNotNull(op);
- this.path = checkNotNull(path);
- this.val = checkNotNull(val);
- }
-
- /**
- * Returns type of change operation.
- *
- * @return Operation
- */
- public Operation op() {
- return op;
- }
-
- /**
- * Returns resource path to be changed.
- *
- * @return resource path relative to device root node
- */
- public ResourceId path() {
- return path;
- }
-
- /**
- * Returns the {@code val} specified.
- *
- * @return {@code val}
- * @throws NoSuchElementException if this object represent {@code DELETE} op.
- */
- public DataNode val() {
- return val.get();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof Change) {
- Change that = (Change) obj;
- return Objects.equals(this.op, that.op) &&
- Objects.equals(this.path, that.path) &&
- Objects.equals(this.val, that.val);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(op, path, val);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("op", op)
- .add("path", path)
- .add("val", val)
- .toString();
- }
- }
-}
\ No newline at end of file
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetResponse.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetResponse.java
deleted file mode 100644
index 0bc9502293..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/SetResponse.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync.operation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.Objects;
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.onosproject.d.config.sync.operation.SetRequest.Change.Operation;
-import org.onosproject.yang.model.ResourceId;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-
-
-@Beta
-public final class SetResponse {
-
- // partially borrowed from io.grpc.Status.Code,
- // might want to borrow all of them
- public enum Code {
- OK,
- CANCELLED,
-
- UNKNOWN,
-
- INVALID_ARGUMENT,
-
- NOT_FOUND,
- ALREADY_EXISTS,
-
- FAILED_PRECONDITION,
- ABORTED,
- UNAVAILABLE,
- }
-
- private final Collection> subjects;
-
- private final SetResponse.Code code;
-
- // human readable error message for logging purpose
- private final String message;
-
- SetResponse(Collection> subjects,
- SetResponse.Code code,
- String message) {
- this.subjects = ImmutableList.copyOf(subjects);
- this.code = checkNotNull(code);
- this.message = checkNotNull(message);
- }
-
- public Collection> subjects() {
- return subjects;
- }
-
- public Code code() {
- return code;
- }
-
- public String message() {
- return message;
- }
-
-
- /**
- * Creates SetResponse instance from request.
- *
- * @param request original request this response corresponds to
- * @param code response status code
- * @param message human readable error message for logging purpose.
- * can be left empty string on OK response.
- * @return SetResponse instance
- */
- public static SetResponse response(SetRequest request,
- Code code,
- String message) {
- return new SetResponse(request.subjects(), code, checkNotNull(message));
- }
-
- /**
- * Creates successful SetResponce instance from request.
- *
- * @param request original request this response corresponds to
- * @return SetResponse instance
- */
- public static SetResponse ok(SetRequest request) {
- return new SetResponse(request.subjects(), Code.OK, "");
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(subjects, code, message);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SetResponse) {
- SetResponse that = (SetResponse) obj;
- return Objects.equals(this.subjects, that.subjects) &&
- Objects.equals(this.code, that.code) &&
- Objects.equals(this.message, that.message);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("code", code)
- .add("subjects", subjects)
- .add("message", message)
- .toString();
- }
-
-
-
-}
\ No newline at end of file
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/package-info.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/package-info.java
deleted file mode 100644
index d7612e9fb5..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/operation/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Dynamic config synchronizer API related value objects.
- */
-package org.onosproject.d.config.sync.operation;
diff --git a/apps/configsync/src/main/java/org/onosproject/d/config/sync/package-info.java b/apps/configsync/src/main/java/org/onosproject/d/config/sync/package-info.java
deleted file mode 100644
index 8da2769e9e..0000000000
--- a/apps/configsync/src/main/java/org/onosproject/d/config/sync/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * Dynamic config synchronizer API.
- */
-package org.onosproject.d.config.sync;
diff --git a/apps/configsync/src/test/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizerTest.java b/apps/configsync/src/test/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizerTest.java
deleted file mode 100644
index bfdead6ad5..0000000000
--- a/apps/configsync/src/test/java/org/onosproject/d/config/sync/impl/DynamicDeviceConfigSynchronizerTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.d.config.sync.impl;
-
-import static org.junit.Assert.*;
-import static org.onosproject.d.config.ResourceIds.ROOT_ID;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiFunction;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.config.DynamicConfigEvent;
-import org.onosproject.config.DynamicConfigServiceAdapter;
-import org.onosproject.config.Filter;
-import org.onosproject.d.config.DeviceResourceIds;
-import org.onosproject.d.config.ResourceIds;
-import org.onosproject.d.config.sync.DeviceConfigSynchronizationProvider;
-import org.onosproject.d.config.sync.operation.SetRequest;
-import org.onosproject.d.config.sync.operation.SetRequest.Change;
-import org.onosproject.d.config.sync.operation.SetRequest.Change.Operation;
-import org.onosproject.d.config.sync.operation.SetResponse;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.config.NetworkConfigServiceAdapter;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.yang.model.DataNode;
-import org.onosproject.yang.model.InnerNode;
-import org.onosproject.yang.model.LeafNode;
-import org.onosproject.yang.model.ResourceId;
-
-import com.google.common.collect.Iterables;
-
-public class DynamicDeviceConfigSynchronizerTest {
-
- static final String TEST_NS = "testNS";
-
- static final ResourceId REL_INTERFACES = ResourceId.builder()
- .addBranchPointSchema("interfaces", TEST_NS)
- .build();
-
- static final DeviceId DID = DeviceId.deviceId("test:device1");
-
- DynamicDeviceConfigSynchronizer sut;
-
- TestDynamicConfigService dyConService;
-
- CountDownLatch providerCalled = new CountDownLatch(1);
-
- /**
- * DynamicConfigService.readNode(ResourceId, Filter) stub.
- */
- BiFunction onDcsRead;
-
- BiFunction> onSetConfiguration;
-
- @Before
- public void setUp() throws Exception {
-
- sut = new DynamicDeviceConfigSynchronizer();
- dyConService = new TestDynamicConfigService();
- sut.dynConfigService = dyConService;
- sut.netcfgService = new NetworkConfigServiceAdapter();
-
- sut.activate();
-
- sut.register(new MockDeviceConfigSynchronizerProvider());
- }
-
- @After
- public void tearDown() throws Exception {
- sut.deactivate();
- }
-
- @Test
- public void testDispatchRequest() throws Exception {
-
- ResourceId devicePath = DeviceResourceIds.toResourceId(DID);
- ResourceId cfgPath = REL_INTERFACES;
- ResourceId absPath = ResourceIds.concat(devicePath, cfgPath);
- ResourceId evtPath = ResourceIds.relativize(ROOT_ID, absPath);
- DynamicConfigEvent event = new DynamicConfigEvent(DynamicConfigEvent.Type.NODE_REPLACED, evtPath);
-
- // assertions
- onDcsRead = (path, filter) -> {
- assertTrue(filter.isEmptyFilter());
- assertEquals("DCService get access by root relative RID", evtPath, path);
- return deviceConfigNode();
- };
-
- onSetConfiguration = (deviceId, request) -> {
- assertEquals(DID, deviceId);
- assertEquals(1, request.changes().size());
- Change change = Iterables.get(request.changes(), 0);
- assertEquals("Provider get access by rel RID", REL_INTERFACES, change.path());
- assertEquals(Operation.REPLACE, change.op());
- assertEquals("interfaces", change.val().key().schemaId().name());
- // walk and test children if it adds value
-
- providerCalled.countDown();
- return CompletableFuture.completedFuture(SetResponse.ok(request));
- };
-
- // start test run
-
- // imitate event from DCS
- dyConService.postEvent(event);
-
- // assert that it reached the provider
- providerCalled.await(5, TimeUnit.HOURS);
- }
-
- /**
- * DataNode for testing.
- *
- *
- * +-interfaces
- * |
- * +- interface{intf-name="en0"}
- * |
- * +- speed = "10G"
- * +- state = "up"
- *
- *
- * @return DataNode
- */
- private DataNode deviceConfigNode() {
- InnerNode.Builder intfs = InnerNode.builder("interfaces", TEST_NS);
- intfs.type(DataNode.Type.SINGLE_INSTANCE_NODE);
- InnerNode.Builder intf = intfs.createChildBuilder("interface", TEST_NS);
- intf.type(DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE);
- intf.addKeyLeaf("name", TEST_NS, "Ethernet0/0");
- LeafNode.Builder speed = intf.createChildBuilder("mtu", TEST_NS, "1500");
- speed.type(DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE);
-
- intf.addNode(speed.build());
- intfs.addNode(intf.build());
- return intfs.build();
- }
-
- private class TestDynamicConfigService extends DynamicConfigServiceAdapter {
-
- public void postEvent(DynamicConfigEvent event) {
- listenerRegistry.process(event);
- }
-
- @Override
- public DataNode readNode(ResourceId path, Filter filter) {
- return onDcsRead.apply(path, filter);
- }
- }
-
- private class MockDeviceConfigSynchronizerProvider
- implements DeviceConfigSynchronizationProvider {
-
- @Override
- public ProviderId id() {
- return new ProviderId(DID.uri().getScheme(), "test-provider");
- }
-
- @Override
- public CompletableFuture setConfiguration(DeviceId deviceId,
- SetRequest request) {
- return onSetConfiguration.apply(deviceId, request);
- }
- }
-
-}
diff --git a/apps/evpn-route-service/BUILD b/apps/evpn-route-service/BUILD
deleted file mode 100644
index d099839500..0000000000
--- a/apps/evpn-route-service/BUILD
+++ /dev/null
@@ -1,11 +0,0 @@
-BUNDLES = [
- "//apps/evpn-route-service/api:onos-apps-evpn-route-service-api",
- "//apps/evpn-route-service/app:onos-apps-evpn-route-service-app",
-]
-
-onos_app(
- category = "Traffic Engineering",
- included_bundles = BUNDLES,
- title = "EVPN Routing",
- url = "http://onosproject.org",
-)
diff --git a/apps/evpn-route-service/api/BUILD b/apps/evpn-route-service/api/BUILD
deleted file mode 100644
index f72e3bcff0..0000000000
--- a/apps/evpn-route-service/api/BUILD
+++ /dev/null
@@ -1,3 +0,0 @@
-osgi_jar_with_tests(
- deps = CORE_DEPS,
-)
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstance.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstance.java
deleted file mode 100644
index 5288db7dad..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstance.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.List;
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents a evpn instance.
- */
-public final class EvpnInstance {
-
- private final RouteDistinguisher rd;
- private final List importRtList;
- private final List exportRtList;
- private final EvpnInstanceName evpnName;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param rd route distinguisher
- * @param importRtList import rotue targets
- * @param exportRtList export rotue targets
- * @param evpnName vpn instance name
- */
- private EvpnInstance(RouteDistinguisher rd,
- List importRtList,
- List exportRtList,
- EvpnInstanceName evpnName) {
- checkNotNull(rd);
- //checkNotNull(rt);
- checkNotNull(evpnName);
- this.rd = rd;
- this.importRtList = importRtList;
- this.exportRtList = exportRtList;
- this.evpnName = evpnName;
- }
-
- /**
- * Creats the instance of EvpnInstance.
- *
- * @param rd route distinguisher
- * @param importRtList import rotue targets
- * @param exportRtList export rotue targets
- * @param evpnName vpn instance name
- * @return EvpnInstance
- */
- public static EvpnInstance evpnInstance(RouteDistinguisher rd,
- List importRtList,
- List exportRtList,
- EvpnInstanceName evpnName) {
- return new EvpnInstance(rd, importRtList, exportRtList, evpnName);
- }
-
- /**
- * Getter of RouteDistinguisher.
- *
- * @return RouteDistinguisher
- */
- public RouteDistinguisher routeDistinguisher() {
- return rd;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
-
- public List importRouteTarget() {
- return importRtList;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
- public List exportRouteTarget() {
- return exportRtList;
- }
-
- /**
- * Getter of vpn instance name.
- *
- * @return evpnName
- */
- public EvpnInstanceName evpnName() {
- return evpnName;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(rd, importRtList, exportRtList, evpnName);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnInstance)) {
- return false;
- }
-
- EvpnInstance that = (EvpnInstance) other;
-
- return Objects.equals(this.evpnName, that.evpnName)
- && Objects.equals(this.rd, that.rd)
- && Objects.equals(this.importRtList, that.importRtList)
- && Objects.equals(this.exportRtList, that.exportRtList);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("evpnName", this.evpnName)
- .add("rd", this.rd).add("import rt", this.importRtList)
- .add("export rt", this.exportRtList).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceName.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceName.java
deleted file mode 100644
index f1ea22ac16..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceName.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Represents the EvpnInstanceName.
- */
-public final class EvpnInstanceName {
- private final String evpnName;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param evpnName EvpnInstanceName
- */
- private EvpnInstanceName(String evpnName) {
- this.evpnName = evpnName;
- }
-
- /**
- * Creates instance of EvpnInstanceName.
- *
- * @param evpnName evpnName
- * @return evpnInstanceName
- */
- public static EvpnInstanceName evpnName(String evpnName) {
- return new EvpnInstanceName(evpnName);
- }
-
- /**
- * Get vpn instance name.
- *
- * @return evpnName
- */
- public String getEvpnName() {
- return evpnName;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(evpnName);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof EvpnInstanceName) {
- EvpnInstanceName other = (EvpnInstanceName) obj;
- return Objects.equals(this.evpnName, other.evpnName);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("evpnName", evpnName).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceNextHop.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceNextHop.java
deleted file mode 100644
index 49ad2c5408..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceNextHop.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Represents a evpn instance nexthop.
- */
-public final class EvpnInstanceNextHop {
-
- private final IpAddress nextHop;
- private final Label label;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param nextHop nexthop
- * @param label label
- */
- private EvpnInstanceNextHop(IpAddress nextHop, Label label) {
- this.nextHop = nextHop;
- this.label = label;
- }
-
- /**
- * creates instance of EvpnInstanceNextHop.
- *
- * @param nextHop nexthop
- * @param label label
- * @return evpnInstanceNexthop
- */
- public static EvpnInstanceNextHop evpnNextHop(IpAddress nextHop,
- Label label) {
- return new EvpnInstanceNextHop(nextHop, label);
- }
-
- /**
- * Returns the next hop IP address.
- *
- * @return next hop
- */
- public IpAddress nextHop() {
- return nextHop;
- }
-
- /**
- * Returns the label.
- *
- * @return Label
- */
- public Label label() {
- return label;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(nextHop, label);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnInstanceNextHop)) {
- return false;
- }
-
- EvpnInstanceNextHop that = (EvpnInstanceNextHop) other;
-
- return Objects.equals(this.nextHop(), that.nextHop())
- && Objects.equals(this.label, that.label);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("nextHop", this.nextHop())
- .add("label", this.label).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstancePrefix.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstancePrefix.java
deleted file mode 100644
index 2f30538917..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstancePrefix.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents a evpn instance prefix.
- */
-public final class EvpnInstancePrefix {
-
- private final MacAddress macAddress;
- private final IpPrefix ipPrefix;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param macAddress Mac address
- * @param ipPrefix IP address
- */
- private EvpnInstancePrefix(MacAddress macAddress,
- IpPrefix ipPrefix) {
- checkNotNull(macAddress);
- this.macAddress = macAddress;
- this.ipPrefix = ipPrefix;
- }
-
- /**
- * Creates the instance of EvpnInstancePrefix.
- *
- * @param macAddress Mac address
- * @param ipPrefix IP address
- * @return Evpn instance prefix
- */
- public static EvpnInstancePrefix evpnPrefix(MacAddress macAddress,
- IpPrefix ipPrefix) {
- return new EvpnInstancePrefix(macAddress, ipPrefix);
- }
-
- /**
- * Returns the MAC of the route.
- *
- * @return MAC address
- */
- public MacAddress macAddress() {
- return macAddress;
- }
-
- /**
- * Returns the IP prefix of the route.
- *
- * @return IP prefix
- */
- public IpPrefix ipPrefix() {
- return ipPrefix;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(macAddress);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnInstancePrefix)) {
- return false;
- }
-
- EvpnInstancePrefix that = (EvpnInstancePrefix) other;
-
- return Objects.equals(this.macAddress, that.macAddress)
- && Objects.equals(this.ipPrefix, that.ipPrefix);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("macAddress", this.macAddress)
- .add("ipAddress", this.ipPrefix).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceRoute.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceRoute.java
deleted file mode 100644
index ca0c8bd855..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInstanceRoute.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents a evpn instance route.
- */
-public class EvpnInstanceRoute {
-
- private final EvpnInstanceName evpnName;
- private final RouteDistinguisher rd;
- private List importRtList;
- private List exportRtList;
- private final EvpnInstancePrefix evpnInstancePrefix;
- private final EvpnInstanceNextHop evpnInstanceNextHop;
- private final IpPrefix prefix;
- private final IpAddress nextHop;
- private final Label label;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param evpnName vpn instance name
- * @param rd route distinguisher
- * @param importRtList import route targets
- * @param exportRtList export route targets
- * @param evpnInstancePrefix evpn intance prefix
- * @param evpnInstanceNextHop evpn instance nexthop
- * @param prefix evpn prefix
- * @param nextHop evpn nexthop
- * @param label label
- */
- public EvpnInstanceRoute(EvpnInstanceName evpnName,
- RouteDistinguisher rd,
- List importRtList,
- List exportRtList,
- EvpnInstancePrefix evpnInstancePrefix,
- EvpnInstanceNextHop evpnInstanceNextHop,
- IpPrefix prefix,
- IpAddress nextHop,
- Label label) {
- checkNotNull(evpnName);
- checkNotNull(prefix);
- //checkNotNull(nextHop); //can be NULL in MP un reach
- checkNotNull(rd);
-
- this.evpnName = evpnName;
- this.rd = rd;
- this.importRtList = importRtList;
- this.exportRtList = exportRtList;
- this.prefix = prefix;
- this.nextHop = nextHop;
- this.evpnInstancePrefix = evpnInstancePrefix;
- this.evpnInstanceNextHop = evpnInstanceNextHop;
- this.label = label;
- }
-
- /**
- * Returns the evpnName.
- *
- * @return EvpnInstanceName
- */
- public EvpnInstanceName evpnInstanceName() {
- return evpnName;
- }
-
- /**
- * Returns the route distinguisher.
- *
- * @return RouteDistinguisher
- */
- public RouteDistinguisher routeDistinguisher() {
- return rd;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
-
- public List importRouteTarget() {
- return importRtList;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
- public List exportRouteTarget() {
- return exportRtList;
- }
-
- /**
- * Set import list.
- *
- * @param importRtList import list
- */
- public void setImportRtList(List importRtList) {
- this.importRtList = importRtList;
- }
-
- /**
- * Set export list.
- *
- * @param exportRtList export list
- */
- public void setExportRtList(List exportRtList) {
- this.exportRtList = exportRtList;
- }
-
- /**
- * Returns EvpnInstancePrefix of the evpn private route.
- *
- * @return EvpnInstancePrefix
- */
-
- public EvpnInstancePrefix getevpnInstancePrefix() {
- return evpnInstancePrefix;
- }
-
- /**
- * Returns EvpnInstanceNextHop of the evpn private route.
- *
- * @return EvpnInstancePrefix
- */
-
- public EvpnInstanceNextHop getEvpnInstanceNextHop() {
- return evpnInstanceNextHop;
- }
-
- /**
- * Returns prefix of the evpn private route.
- *
- * @return EvpnInstancePrefix
- */
- public IpPrefix prefix() {
- return prefix;
- }
-
- /**
- * Returns the label.
- *
- * @return EvpnInstanceName
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * Returns the label.
- *
- * @return EvpnInstanceName
- */
- public IpAddress getNextHopl() {
- return nextHop;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(evpnName, prefix, nextHop,
- rd, importRtList, exportRtList);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnInstanceRoute)) {
- return false;
- }
-
- EvpnInstanceRoute that = (EvpnInstanceRoute) other;
-
- return Objects.equals(prefix, that.prefix)
- && Objects.equals(nextHop, that.nextHop)
- && Objects.equals(evpnName, that.evpnName)
- && Objects.equals(rd, that.rd)
- && Objects.equals(importRtList, that.importRtList)
- && Objects.equals(exportRtList, that.exportRtList);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("prefix", prefix)
- .add("nextHop", nextHop)
- .add("rd", rd)
- .add("import rt", importRtList)
- .add("export rt", exportRtList)
- .add("evpnName", evpnName)
- .toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInternalRouteEvent.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInternalRouteEvent.java
deleted file mode 100644
index 7a71875ed3..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnInternalRouteEvent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import org.onosproject.event.AbstractEvent;
-
-/**
- * Route event for signalling between the store and the manager.
- */
-public class EvpnInternalRouteEvent extends
- AbstractEvent {
-
- /**
- * Internal route event type.
- */
- public enum Type {
- /**
- * Indicates a route was added to the store.
- */
- ROUTE_ADDED,
-
- /**
- * Indicates a route was removed from the store.
- */
- ROUTE_REMOVED
- }
-
- /**
- * Creates a new internal route event.
- *
- * @param type route event type
- * @param subject route set
- */
- public EvpnInternalRouteEvent(Type type, EvpnRouteSet subject) {
- super(type, subject);
- }
-
- public EvpnInternalRouteEvent(Type type, EvpnRouteSet subject, long time) {
- super(type, subject, time);
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnNextHop.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnNextHop.java
deleted file mode 100644
index ac1e06bc99..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnNextHop.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Represents a evpn next hop.
- */
-public final class EvpnNextHop {
-
- private final IpAddress nextHop;
- private final List importRtList;
- private final List exportRtList;
- private final Label label;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param nextHop evpn next hop
- * @param importRtList import route targets
- * @param importRtList export route targets
- * @param label label
- */
- private EvpnNextHop(IpAddress nextHop, List importRtList, List exportRtList,
- Label label) {
- this.nextHop = nextHop;
- this.importRtList = importRtList;
- this.exportRtList = exportRtList;
- this.label = label;
- }
-
- /**
- * Creates the Evpn Next hop with given parameters.
- *
- * @param nextHop Next hop of the route
- * @param importRtList route target import list
- * @param exportRtList route target export list
- * @param label label of evpn route
- * @return EvpnNextHop
- */
- public static EvpnNextHop evpnNextHop(IpAddress nextHop, List importRtList,
- List exportRtList,
- Label label) {
- return new EvpnNextHop(nextHop, importRtList, exportRtList, label);
- }
-
- /**
- * Returns the next hop IP address.
- *
- * @return next hop
- */
- public IpAddress nextHop() {
- return nextHop;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
-
- public List importRouteTarget() {
- return importRtList;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
- public List exportRouteTarget() {
- return exportRtList;
- }
-
- /**
- * Returns the label of evpn route.
- *
- * @return Label
- */
- public Label label() {
- return label;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(nextHop, importRtList, exportRtList, label);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnNextHop)) {
- return false;
- }
-
- EvpnNextHop that = (EvpnNextHop) other;
-
- return Objects.equals(this.nextHop(), that.nextHop())
- && Objects.equals(this.importRtList, that.importRtList)
- && Objects.equals(this.exportRtList, that.exportRtList)
- && Objects.equals(this.label, that.label);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("nextHop", this.nextHop())
- .add("import rt list", this.importRtList).add("export rt list", this.exportRtList)
- .add("label", this.label).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnPrefix.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnPrefix.java
deleted file mode 100644
index 3f70ef5722..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnPrefix.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents a evpn prefix.
- */
-public final class EvpnPrefix {
-
- private final RouteDistinguisher rd;
- private final MacAddress macAddress;
- private final IpPrefix ipAddress;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param rd route distinguisher
- * @param macAddress mac address
- * @param ipAddress IP address
- */
- public EvpnPrefix(RouteDistinguisher rd, MacAddress macAddress,
- IpPrefix ipAddress) {
- checkNotNull(rd);
- checkNotNull(macAddress);
- checkNotNull(ipAddress);
- this.rd = rd;
- this.macAddress = macAddress;
- this.ipAddress = ipAddress;
- }
-
- /**
- * Creates the evpn prefix by given parameters.
- *
- * @param rd route distinguisher
- * @param macAddress mac address
- * @param ipAddress ip address
- * @return EvpnPrefix
- */
- public static EvpnPrefix evpnPrefix(RouteDistinguisher rd,
- MacAddress macAddress,
- IpPrefix ipAddress) {
- return new EvpnPrefix(rd, macAddress, ipAddress);
- }
-
- /**
- * Returns the route distinguisher.
- *
- * @return RouteDistinguisher
- */
- public RouteDistinguisher routeDistinguisher() {
- return rd;
- }
-
- /**
- * Returns the mac address.
- *
- * @return MacAddress
- */
- public MacAddress macAddress() {
- return macAddress;
- }
-
- /**
- * Returns the IP address.
- *
- * @return Ip4Address
- */
- public IpPrefix ipAddress() {
- return ipAddress;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(rd, macAddress, ipAddress);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnPrefix)) {
- return false;
- }
-
- EvpnPrefix that = (EvpnPrefix) other;
-
- return Objects.equals(this.macAddress(), that.macAddress())
- && Objects.equals(this.ipAddress, that.ipAddress)
- && Objects.equals(this.rd, that.rd);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("macAddress", this.macAddress())
- .add("ipAddress", this.ipAddress()).add("rd", this.rd)
- .toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRoute.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRoute.java
deleted file mode 100644
index 0f025d3305..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRoute.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents a evpn route.
- */
-public class EvpnRoute {
-
-
- /**
- * Source of the route.
- */
- public enum Source {
- /**
- * Route came from app source.
- */
- LOCAL,
-
- /**
- * Route came from remote bgp peer source.
- */
- REMOTE,
- }
-
- private final Source source;
- private final MacAddress prefixMac;
- private final IpPrefix prefix;
- private final IpAddress nextHop;
- private final RouteDistinguisher rd;
- private List importRtList;
- private List exportRtList;
- private final Label label;
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param source route source
- * @param prefixMac mac address
- * @param prefix ip address
- * @param nextHop evpn nexthop
- * @param rd route distinguisher
- * @param importRtList import route targets
- * @param exportRtList export route targets
- * @param label evpn route label
- */
- public EvpnRoute(Source source,
- MacAddress prefixMac,
- IpPrefix prefix,
- IpAddress nextHop,
- RouteDistinguisher rd,
- List importRtList,
- List exportRtList,
- Label label) {
-
- checkNotNull(prefixMac);
- checkNotNull(prefix);
- //checkNotNull(nextHop);//next hop can be null in case of MP un reach.
- checkNotNull(rd);
- checkNotNull(label);
- this.source = checkNotNull(source);
- this.prefix = prefix;
- this.prefixMac = prefixMac;
- this.nextHop = nextHop;
- this.rd = rd;
- this.importRtList = importRtList;
- this.exportRtList = exportRtList;
- this.label = label;
- }
-
- /**
- * Constructor to initialize the parameters.
- *
- * @param source route source
- * @param prefixMac mac address
- * @param prefix ip address
- * @param nextHop evpn nexthop
- * @param rdToString route distinguisher
- * @param importRtList import route targets
- * @param exportRtList export route targets
- * @param labelToInt evpn route label
- */
- public EvpnRoute(Source source,
- MacAddress prefixMac,
- IpPrefix prefix,
- IpAddress nextHop,
- String rdToString,
- List importRtList,
- List exportRtList,
- int labelToInt) {
- checkNotNull(prefixMac);
- checkNotNull(prefix);
- //checkNotNull(nextHop); //next hop can be null in case of MP un reach.
- this.source = checkNotNull(source);
- this.prefix = prefix;
- this.prefixMac = prefixMac;
- this.nextHop = nextHop;
- this.rd = RouteDistinguisher.routeDistinguisher(rdToString);
- this.importRtList = importRtList;
- this.exportRtList = exportRtList;
- this.label = Label.label(labelToInt);
- }
-
- /**
- * Returns the route source.
- *
- * @return route source
- */
- public Source source() {
- return source;
- }
-
- /**
- * Returns the address.
- *
- * @return MacAddress
- */
- public MacAddress prefixMac() {
- return prefixMac;
- }
-
- /**
- * Returns the IPv4 address.
- *
- * @return Ip4Address
- */
- public IpPrefix prefixIp() {
- return prefix;
- }
-
- /**
- * Returns the IPv4 address.
- *
- * @return Ip4Address
- */
- public EvpnPrefix evpnPrefix() {
- return new EvpnPrefix(rd, prefixMac,
- prefix);
- }
-
-
- /**
- * Returns the next hop IP address.
- *
- * @return Ip4Address
- */
- public IpAddress ipNextHop() {
- return nextHop;
- }
-
- public EvpnNextHop nextHop() {
- return EvpnNextHop.evpnNextHop(nextHop,
- importRtList,
- exportRtList,
- label);
- }
-
- /**
- * Returns the routeDistinguisher.
- *
- * @return RouteDistinguisher
- */
- public RouteDistinguisher routeDistinguisher() {
- return rd;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
-
- public List importRouteTarget() {
- return importRtList;
- }
-
- /**
- * Returns the Route targets.
- *
- * @return RouteTarget List
- */
- public List exportRouteTarget() {
- return exportRtList;
- }
-
- /**
- * Set import list.
- *
- * @param importRtList import list
- */
- public void setImportRtList(List importRtList) {
- this.importRtList = importRtList;
- }
-
- /**
- * Set export list.
- *
- * @param exportRtList export list
- */
- public void setExportRtList(List exportRtList) {
- this.exportRtList = exportRtList;
- }
-
- /**
- * Returns the label.
- *
- * @return Label
- */
- public Label label() {
- return label;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(prefixMac,
- prefix,
- nextHop,
- rd,
- importRtList,
- exportRtList,
- label);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnRoute)) {
- return false;
- }
-
- EvpnRoute that = (EvpnRoute) other;
-
- return Objects.equals(prefixMac, that.prefixMac)
- && Objects.equals(prefix, that.prefix)
- && Objects.equals(nextHop, that.nextHop)
- && Objects.equals(this.rd, that.rd)
- && Objects.equals(this.importRtList, that.importRtList)
- && Objects.equals(this.exportRtList, that.exportRtList)
- && Objects.equals(this.label, that.label);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("prefixMac", prefixMac)
- .add("prefix", prefix)
- .add("nextHop", nextHop)
- .add("rd", this.rd)
- .add("import rt", this.importRtList)
- .add("export rt", this.exportRtList)
- .add("label", this.label)
- .toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteAdminService.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteAdminService.java
deleted file mode 100644
index cc9e20010d..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteAdminService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Collection;
-
-/**
- * Service allowing mutation of EVPN routing state.
- */
-public interface EvpnRouteAdminService extends EvpnRouteService {
-
- /**
- * Updates the given routes in the route service.
- *
- * @param routes collection of routes to update
- */
- void update(Collection routes);
-
- /**
- * Withdraws the given routes from the route service.
- *
- * @param routes collection of routes to withdraw
- */
- void withdraw(Collection routes);
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteEvent.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteEvent.java
deleted file mode 100644
index 5e7f83a421..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteEvent.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Objects;
-
-import org.onlab.util.Tools;
-import org.onosproject.event.AbstractEvent;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Describes an event about a route.
- */
-public class EvpnRouteEvent extends AbstractEvent {
-
- private final EvpnRoute prevSubject;
- private final Collection alternativeRoutes;
-
- /**
- * Route event type.
- */
- public enum Type {
-
- /**
- * Route is new and the next hop is resolved.
- *
- * The subject of this event should be the route being added.
- * The prevSubject of this event should be null.
- *
- */
- ROUTE_ADDED,
-
- /**
- * Route has updated information.
- *
- * The subject of this event should be the new route.
- * The prevSubject of this event should be the old route.
- *
- */
- ROUTE_UPDATED,
-
- /**
- * Route was removed or the next hop becomes unresolved.
- *
- * The subject of this event should be the route being removed.
- * The prevSubject of this event should be null.
- *
- */
- ROUTE_REMOVED,
-
- /**
- * The set of alternative routes for the subject's prefix has changed,
- * but the best route is still the same.
- *
- * The subject is the best route for the prefix (which has already been
- * notified in a previous event).
- * The prevSubject of this event is null.
- * The alternatives contains the new set of alternative routes.
- *
- */
- ALTERNATIVE_ROUTES_CHANGED
- }
-
- /**
- * Creates a new route event without specifying previous subject.
- *
- * @param type event type
- * @param subject event subject
- */
- public EvpnRouteEvent(Type type, EvpnRoute subject) {
- this(type, subject, null, Collections.emptySet());
- }
-
- /**
- * Creates a new route event without specifying previous subject.
- *
- * @param type event type
- * @param subject event subject
- * @param alternatives alternative routes for subject's prefix
- */
- public EvpnRouteEvent(Type type, EvpnRoute subject,
- Collection alternatives) {
- this(type, subject, null, alternatives);
- }
-
- /**
- * Creates a new route event.
- *
- * @param type event type
- * @param subject event subject
- * @param time event time
- */
- protected EvpnRouteEvent(Type type, EvpnRoute subject, long time) {
- super(type, subject, time);
- this.prevSubject = null;
-
- this.alternativeRoutes = Collections.emptySet();
- }
-
- /**
- * Creates a new route event with previous subject.
- *
- * @param type event type
- * @param subject event subject
- * @param prevSubject previous subject
- */
- public EvpnRouteEvent(Type type, EvpnRoute subject, EvpnRoute prevSubject) {
- this(type, subject, prevSubject, Collections.emptySet());
- }
-
- /**
- * Creates a new route event with a previous subject and alternative routes.
- *
- * @param type event type
- * @param subject event subject
- * @param prevSubject previous subject
- * @param alternatives alternative routes for subject's prefix
- */
- public EvpnRouteEvent(Type type, EvpnRoute subject, EvpnRoute prevSubject,
- Collection alternatives) {
- super(type, subject);
- this.prevSubject = prevSubject;
- this.alternativeRoutes = alternatives;
- }
-
- /**
- * Returns the previous subject of the event.
- *
- * @return previous subject to which this event pertains
- */
- public EvpnRoute prevSubject() {
- return prevSubject;
- }
-
- /**
- * Returns the set of alternative routes for the subject's prefix.
- *
- * @return alternative routes
- */
- public Collection alternatives() {
- return alternativeRoutes;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(subject(), type(), prevSubject(), alternativeRoutes);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnRouteEvent)) {
- return false;
- }
-
- EvpnRouteEvent that = (EvpnRouteEvent) other;
-
- return Objects.equals(this.subject(), that.subject()) &&
- Objects.equals(this.type(), that.type()) &&
- Objects.equals(this.prevSubject, that.prevSubject) &&
- Objects.equals(this.alternativeRoutes, that.alternativeRoutes);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("time", Tools.defaultOffsetDataTime(time()))
- .add("type", type())
- .add("subject", subject())
- .add("prevSubject", prevSubject)
- .add("alternatives", alternativeRoutes)
- .toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteListener.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteListener.java
deleted file mode 100644
index 32a35c2fd4..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Listener for route events.
- */
-public interface EvpnRouteListener extends EventListener {
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteService.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteService.java
deleted file mode 100644
index ca9c031254..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteService.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Collection;
-
-import org.onosproject.event.ListenerService;
-
-/**
- * EVPN route service.
- */
-public interface EvpnRouteService extends ListenerService {
-
-
- /**
- * Returns the set of route tables in the system.
- *
- * @return collection of route table IDs.
- */
- Collection getRouteTables();
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteSet.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteSet.java
deleted file mode 100644
index 707df2254b..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteSet.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-import java.util.Set;
-
-import com.google.common.collect.ImmutableSet;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A set of routes for a particular prefix in a route table.
- */
-public class EvpnRouteSet {
- private final EvpnRouteTableId tableId;
-
- private final EvpnPrefix prefix;
- private final Set routes;
-
- /**
- * Creates a new route set.
- *
- * @param tableId route table ID
- * @param prefix IP prefix
- * @param routes routes for the given prefix
- */
- public EvpnRouteSet(EvpnRouteTableId tableId, EvpnPrefix prefix, Set
- routes) {
- this.tableId = checkNotNull(tableId);
- this.prefix = checkNotNull(prefix);
- this.routes = ImmutableSet.copyOf(checkNotNull(routes));
- }
-
- /**
- * Returns the route table ID.
- *
- * @return route table ID
- */
- public EvpnRouteTableId tableId() {
- return tableId;
- }
-
- /**
- * Returns the IP prefix.
- *
- * @return IP prefix
- */
- public EvpnPrefix prefix() {
- return prefix;
- }
-
- /**
- * Returns the set of routes.
- *
- * @return routes
- */
- public Set routes() {
- return routes;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(tableId, prefix, routes);
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof EvpnRouteSet)) {
- return false;
- }
-
- EvpnRouteSet that = (EvpnRouteSet) other;
-
- return Objects.equals(this.tableId, that.tableId) &&
- Objects.equals(this.prefix, that.prefix) &&
- Objects.equals(this.routes, that.routes);
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStore.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStore.java
deleted file mode 100644
index c06704f662..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStore.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.store.Store;
-
-/**
- * EVPN route store.
- */
-public interface EvpnRouteStore extends Store {
-
- /**
- * Adds or updates the given route in the store.
- *
- * @param route route to add or update
- */
- void updateRoute(EvpnRoute route);
-
- /**
- * Removes the given route from the store.
- *
- * @param route route to remove
- */
- void removeRoute(EvpnRoute route);
-
- /**
- * Returns the IDs for all route tables in the store.
- *
- * @return route table IDs
- */
- Set getRouteTables();
-
- /**
- * Returns the routes in the given route table, grouped by prefix.
- *
- * @param table route table ID
- * @return routes
- */
- Collection getRoutes(EvpnRouteTableId table);
-
- /**
- * Returns the routes that point to the given next hop IP address.
- *
- * @param ip IP address of the next hop
- * @return routes for the given next hop
- */
- // TODO think about including route table info
- Collection getRoutesForNextHop(IpAddress ip);
-
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStoreDelegate.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStoreDelegate.java
deleted file mode 100644
index d714adcc37..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteStoreDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import org.onosproject.store.StoreDelegate;
-
-/**
- * Route store delegate abstraction.
- */
-public interface EvpnRouteStoreDelegate extends
- StoreDelegate {
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteTableId.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteTableId.java
deleted file mode 100644
index 846a8d1b8b..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnRouteTableId.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-/**
- * Identifier for an EVPN routing table.
- */
-public class EvpnRouteTableId {
- private final String name;
-
- /**
- * Creates a new route table ID.
- *
- * @param name unique name for the route table
- */
- public EvpnRouteTableId(String name) {
- this.name = name;
- }
-
- /**
- * Returns the name of the route table.
- *
- * @return table name
- */
- public String name() {
- return name;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof EvpnRouteTableId) {
- EvpnRouteTableId that = (EvpnRouteTableId) obj;
-
- return Objects.equals(this.name, that.name);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(name);
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnTable.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnTable.java
deleted file mode 100755
index 0b3379fce6..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/EvpnTable.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Collection;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * Represents a route table that stores routes.
- */
-public interface EvpnTable {
-
- /**
- * Adds a route to the route table.
- *
- * @param route route
- */
- void update(EvpnRoute route);
-
- /**
- * Removes a route from the route table.
- *
- * @param route route
- */
- void remove(EvpnRoute route);
-
- /**
- * Returns the route table ID.
- *
- * @return route table ID
- */
- EvpnRouteTableId id();
-
- /**
- * Returns all routes in the route table.
- *
- * @return collection of routes, grouped by prefix
- */
- Collection getRoutes();
-
- /**
- * Returns the routes in this table pertaining to a given prefix.
- *
- * @param prefix IP prefix
- * @return routes for the prefix
- */
- EvpnRouteSet getRoutes(EvpnPrefix prefix);
-
- /**
- * Returns all routes that have the given next hop.
- *
- * @param nextHop next hop IP address
- * @return collection of routes
- */
- Collection getRoutesForNextHop(IpAddress nextHop);
-
- /**
- * Releases route table resources held locally.
- */
- void shutdown();
-
- /**
- * Releases route table resources across the entire cluster.
- */
- void destroy();
-
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/Label.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/Label.java
deleted file mode 100644
index 8d90611ff5..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/Label.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Represents label of the route.
- */
-public final class Label {
- private final int label;
-
- /**
- * Constructor to initialize parameters.
- *
- * @param label route label
- */
- private Label(int label) {
- this.label = label;
- }
-
- /**
- * Creates the label for evpn route.
- *
- * @param label label of evpn route
- * @return Label
- */
- public static Label label(int label) {
- return new Label(label);
- }
-
- /**
- * Returns the label.
- *
- * @return label
- */
- public int getLabel() {
- return label;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(label);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof Label) {
- Label other = (Label) obj;
- return Objects.equals(label, other.label);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("label", label).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/RouteDistinguisher.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/RouteDistinguisher.java
deleted file mode 100644
index ca217b6495..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/RouteDistinguisher.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents Route Distinguisher of device in the network.
- */
-public final class RouteDistinguisher {
- private final String routeDistinguisher;
-
- /**
- * Constructor to initialize parameters.
- *
- * @param routeDistinguisher route distinguisher
- */
- private RouteDistinguisher(String routeDistinguisher) {
- this.routeDistinguisher = routeDistinguisher;
- }
-
- /**
- * Creates the route distinguisher.
- *
- * @param routeDistinguisher route distinguisher
- * @return RouteDistinguisher
- */
- public static RouteDistinguisher routeDistinguisher(String routeDistinguisher) {
- checkNotNull(routeDistinguisher);
- return new RouteDistinguisher(routeDistinguisher);
- }
-
- /**
- * get route distinguisher.
- *
- * @return distinguisher
- */
- public String getRouteDistinguisher() {
- return routeDistinguisher;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(routeDistinguisher);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof RouteDistinguisher) {
- RouteDistinguisher other = (RouteDistinguisher) obj;
- return Objects.equals(this.routeDistinguisher, other.routeDistinguisher);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("routeDistinguisher", this.routeDistinguisher).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/VpnRouteTarget.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/VpnRouteTarget.java
deleted file mode 100644
index 51a9a59006..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/VpnRouteTarget.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Represents Route target of vpn instance.
- */
-public final class VpnRouteTarget {
- private final String routeTarget;
-
- /**
- * Constructor to initialize parameters.
- *
- * @param routeTarget route target
- */
- private VpnRouteTarget(String routeTarget) {
- this.routeTarget = routeTarget;
- }
-
- /**
- * Creates the vpn route target.
- *
- * @param routeTarget route target
- * @return route target
- */
- public static VpnRouteTarget routeTarget(String routeTarget) {
- return new VpnRouteTarget(routeTarget);
- }
-
- /**
- * get the route target.
- *
- * @return route target
- */
- public String getRouteTarget() {
- return routeTarget;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(routeTarget);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof VpnRouteTarget) {
- VpnRouteTarget other = (VpnRouteTarget) obj;
- return Objects.equals(routeTarget, other.routeTarget);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("routeTarget", routeTarget).toString();
- }
-}
diff --git a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/package-info.java b/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/package-info.java
deleted file mode 100644
index 3514c80097..0000000000
--- a/apps/evpn-route-service/api/src/main/java/org/onosproject/evpnrouteservice/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Unicast routing service.
- */
-package org.onosproject.evpnrouteservice;
diff --git a/apps/evpn-route-service/app/BUILD b/apps/evpn-route-service/app/BUILD
deleted file mode 100644
index 67867305fb..0000000000
--- a/apps/evpn-route-service/app/BUILD
+++ /dev/null
@@ -1,8 +0,0 @@
-COMPILE_DEPS = CORE_DEPS + KRYO + [
- "//core/store/serializers:onos-core-serializers",
- "//apps/evpn-route-service/api:onos-apps-evpn-route-service-api",
-]
-
-osgi_jar_with_tests(
- deps = COMPILE_DEPS,
-)
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnListenerQueue.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnListenerQueue.java
deleted file mode 100644
index ce3d01286a..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnListenerQueue.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice.impl;
-
-import org.onosproject.evpnrouteservice.EvpnRouteEvent;
-
-/**
- * Queues updates for a route listener to ensure they are received in the
- * correct order.
- */
-interface EvpnListenerQueue {
-
- /**
- * Posts an event to the listener.
- *
- * @param event event
- */
- void post(EvpnRouteEvent event);
-
- /**
- * Initiates event delivery to the listener.
- */
- void start();
-
- /**
- * Halts event delivery to the listener.
- */
- void stop();
-}
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnRouteManager.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnRouteManager.java
deleted file mode 100644
index f13b89a14b..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/EvpnRouteManager.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice.impl;
-
-import org.onosproject.evpnrouteservice.EvpnInternalRouteEvent;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRouteAdminService;
-import org.onosproject.evpnrouteservice.EvpnRouteEvent;
-import org.onosproject.evpnrouteservice.EvpnRouteListener;
-import org.onosproject.evpnrouteservice.EvpnRouteService;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteStore;
-import org.onosproject.evpnrouteservice.EvpnRouteStoreDelegate;
-import org.onosproject.evpnrouteservice.EvpnRouteTableId;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.concurrent.GuardedBy;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-
-import static java.util.concurrent.Executors.newSingleThreadExecutor;
-import static org.onlab.util.Tools.groupedThreads;
-
-/**
- * Implementation of the EVPN route service.
- */
-@Component(service = { EvpnRouteService.class, EvpnRouteAdminService.class })
-public class EvpnRouteManager implements EvpnRouteService,
- EvpnRouteAdminService {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected EvpnRouteStore evpnRouteStore;
-
- @GuardedBy(value = "this")
- private Map listeners = new
- HashMap<>();
-
- private ThreadFactory threadFactory;
-
- private EvpnRouteStoreDelegate evpnRouteStoreDelegate = new
- InternalEvpnRouteStoreDelegate();
-
- @Activate
- protected void activate() {
- threadFactory = groupedThreads("onos/route", "listener-%d", log);
- evpnRouteStore.setDelegate(evpnRouteStoreDelegate);
-
- }
-
- @Deactivate
- protected void deactivate() {
- evpnRouteStore.unsetDelegate(evpnRouteStoreDelegate);
- synchronized (this) {
- listeners.values().forEach(EvpnListenerQueue::stop);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * In a departure from other services in ONOS, calling addListener will
- * cause all current routes to be pushed to the listener before any new
- * events are sent. This allows a listener to easily get the exact set of
- * routes without worrying about missing any.
- *
- * @param listener listener to be added
- */
- @Override
- public void addListener(EvpnRouteListener listener) {
- synchronized (this) {
- EvpnListenerQueue l = createListenerQueue(listener);
-
- evpnRouteStore.getRouteTables().forEach(routeTableId
- -> {
- Collection routes
- = evpnRouteStore.getRoutes(routeTableId);
- if (routes != null) {
- routes.forEach(route -> {
- Collection evpnRoutes = route.routes();
- for (EvpnRoute evpnRoute : evpnRoutes) {
- l.post(new EvpnRouteEvent(
- EvpnRouteEvent.Type.ROUTE_ADDED,
- evpnRoute,
- route.routes()));
- }
- });
- }
- });
- listeners.put(listener, l);
-
- l.start();
- log.debug("Route synchronization complete");
- }
- }
-
- @Override
- public void removeListener(EvpnRouteListener listener) {
- synchronized (this) {
- EvpnListenerQueue l = listeners.remove(listener);
- if (l != null) {
- l.stop();
- }
- }
- }
-
- /**
- * Posts an event to all listeners.
- *
- * @param event event
- */
-
- private void post(EvpnRouteEvent event) {
- if (event != null) {
- log.debug("Sending event {}", event);
- synchronized (this) {
- listeners.values().forEach(l -> l.post(event));
- }
- }
- }
-
-
- @Override
- public Collection getRouteTables() {
- return evpnRouteStore.getRouteTables();
- }
-
- @Override
- public void update(Collection routes) {
- synchronized (this) {
- routes.forEach(route -> {
- log.debug("Received update {}", route);
- evpnRouteStore.updateRoute(route);
- });
- }
- }
-
- @Override
- public void withdraw(Collection routes) {
- synchronized (this) {
- routes.forEach(route -> {
- log.debug("Received withdraw {}", route);
- evpnRouteStore.removeRoute(route);
- });
- }
- }
-
- /**
- * Creates a new listener queue.
- *
- * @param listener route listener
- * @return listener queue
- */
- DefaultListenerQueue createListenerQueue(EvpnRouteListener listener) {
- return new DefaultListenerQueue(listener);
- }
-
- /**
- * Default route listener queue.
- */
- private class DefaultListenerQueue implements EvpnListenerQueue {
-
- private final ExecutorService executorService;
- private final BlockingQueue queue;
- private final EvpnRouteListener listener;
-
- /**
- * Creates a new listener queue.
- *
- * @param listener route listener to queue updates for
- */
- public DefaultListenerQueue(EvpnRouteListener listener) {
- this.listener = listener;
- queue = new LinkedBlockingQueue<>();
- executorService = newSingleThreadExecutor(threadFactory);
- }
-
- @Override
- public void post(EvpnRouteEvent event) {
- queue.add(event);
- }
-
- @Override
- public void start() {
- executorService.execute(this::poll);
- }
-
- @Override
- public void stop() {
- executorService.shutdown();
- }
-
- private void poll() {
- while (true) {
- try {
- listener.event(queue.take());
- } catch (InterruptedException e) {
- log.info("Route listener event thread shutting down: {}", e.getMessage());
- Thread.currentThread().interrupt();
- break;
- } catch (Exception e) {
- log.warn("Exception during route event handler", e);
- }
- }
- }
- }
-
- /**
- * Delegate to receive events from the route store.
- */
- private class InternalEvpnRouteStoreDelegate implements
- EvpnRouteStoreDelegate {
- EvpnRouteSet routes;
-
- @Override
- public void notify(EvpnInternalRouteEvent event) {
- switch (event.type()) {
- case ROUTE_ADDED:
- routes = event.subject();
- if (routes != null) {
- Collection evpnRoutes = routes.routes();
- for (EvpnRoute evpnRoute : evpnRoutes) {
- post(new EvpnRouteEvent(
- EvpnRouteEvent.Type.ROUTE_ADDED,
- evpnRoute,
- routes.routes()));
- }
- }
- break;
- case ROUTE_REMOVED:
- routes = event.subject();
- if (routes != null) {
- Collection evpnRoutes = routes.routes();
- for (EvpnRoute evpnRoute : evpnRoutes) {
- post(new EvpnRouteEvent(
- EvpnRouteEvent.Type.ROUTE_REMOVED,
- evpnRoute,
- routes.routes()));
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
-}
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/package-info.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/package-info.java
deleted file mode 100644
index 80892c930e..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Implementation of route service.
- */
-package org.onosproject.evpnrouteservice.impl;
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/DistributedEvpnRouteStore.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/DistributedEvpnRouteStore.java
deleted file mode 100644
index 8917325733..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/DistributedEvpnRouteStore.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice.store;
-
-import com.google.common.collect.ImmutableSet;
-import org.onlab.packet.IpAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.evpnrouteservice.EvpnInternalRouteEvent;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteStore;
-import org.onosproject.evpnrouteservice.EvpnRouteStoreDelegate;
-import org.onosproject.evpnrouteservice.EvpnRouteTableId;
-import org.onosproject.evpnrouteservice.EvpnTable;
-import org.onosproject.store.AbstractStore;
-import org.onosproject.store.service.DistributedSet;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.SetEvent;
-import org.onosproject.store.service.SetEventListener;
-import org.onosproject.store.service.StorageService;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static org.onlab.util.Tools.groupedThreads;
-
-/**
- * Route store based on distributed storage.
- */
-@Component(service = EvpnRouteStore.class)
-public class DistributedEvpnRouteStore extends
- AbstractStore
- implements EvpnRouteStore {
-
- private static final Logger log = LoggerFactory
- .getLogger(DistributedEvpnRouteStore.class);
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- public StorageService storageService;
-
- private static final EvpnRouteTableId EVPN_IPV4 = new EvpnRouteTableId("evpn_ipv4");
- private static final EvpnRouteTableId EVPN_IPV6 = new EvpnRouteTableId("evpn_ipv6");
-
- private final SetEventListener masterRouteTableListener =
- new MasterRouteTableListener();
- private final EvpnRouteStoreDelegate ourDelegate = new
- InternalEvpnRouteStoreDelegate();
-
- // Stores the route tables that have been created
- public DistributedSet masterRouteTable;
- // Local memory map to store route table object
- public Map routeTables;
-
- private ExecutorService executor;
-
-
- /**
- * Sets up distributed route store.
- */
- @Activate
- public void activate() {
- routeTables = new ConcurrentHashMap<>();
- executor = Executors.newSingleThreadExecutor(groupedThreads("onos/route", "store", log));
-
- KryoNamespace masterRouteTableSerializer = KryoNamespace.newBuilder()
- .register(EvpnRouteTableId.class)
- .build();
-
- masterRouteTable = storageService.setBuilder()
- .withName("onos-master-route-table")
- .withSerializer(Serializer.using(masterRouteTableSerializer))
- .build()
- .asDistributedSet();
-
- masterRouteTable.forEach(this::createRouteTable);
-
- masterRouteTable.addListener(masterRouteTableListener);
-
- // Add default tables (add is idempotent)
- masterRouteTable.add(EVPN_IPV4);
- masterRouteTable.add(EVPN_IPV6);
-
- log.info("Started");
- }
-
- /**
- * Cleans up distributed route store.
- */
- @Deactivate
- public void deactivate() {
- masterRouteTable.removeListener(masterRouteTableListener);
-
- routeTables.values().forEach(EvpnTable::shutdown);
-
- log.info("Stopped");
- }
-
- @Override
- public void updateRoute(EvpnRoute route) {
- getDefaultRouteTable(route).update(route);
- }
-
- @Override
- public void removeRoute(EvpnRoute route) {
- getDefaultRouteTable(route).remove(route);
- }
-
- @Override
- public Set getRouteTables() {
- return ImmutableSet.copyOf(masterRouteTable);
- }
-
- @Override
- public Collection getRoutes(EvpnRouteTableId table) {
- EvpnTable routeTable = routeTables.get(table);
- if (routeTable == null) {
- return Collections.emptySet();
- } else {
- return ImmutableSet.copyOf(routeTable.getRoutes());
- }
- }
-
- @Override
- public Collection getRoutesForNextHop(IpAddress ip) {
- return getDefaultRouteTable(ip).getRoutesForNextHop(ip);
- }
-
- private void createRouteTable(EvpnRouteTableId tableId) {
- routeTables.computeIfAbsent(tableId, id -> new EvpnRouteTable(id,
- ourDelegate, storageService, executor));
- }
-
- private void destroyRouteTable(EvpnRouteTableId tableId) {
- EvpnTable table = routeTables.remove(tableId);
- if (table != null) {
- table.destroy();
- }
- }
-
- private EvpnTable getDefaultRouteTable(EvpnRoute route) {
- return getDefaultRouteTable(route.prefixIp().address());
- }
-
- private EvpnTable getDefaultRouteTable(IpAddress ip) {
- EvpnRouteTableId routeTableId = (ip.isIp4()) ? EVPN_IPV4 : EVPN_IPV6;
- return routeTables.getOrDefault(routeTableId, EmptyEvpnRouteTable
- .instance());
- }
-
- private class InternalEvpnRouteStoreDelegate implements
- EvpnRouteStoreDelegate {
- @Override
- public void notify(EvpnInternalRouteEvent event) {
- executor.execute(() -> DistributedEvpnRouteStore
- .this.notifyDelegate(event));
- }
- }
-
- private class MasterRouteTableListener implements SetEventListener {
- @Override
- public void event(SetEvent event) {
- switch (event.type()) {
- case ADD:
- executor.execute(() -> createRouteTable(event.entry()));
- break;
- case REMOVE:
- executor.execute(() -> destroyRouteTable(event.entry()));
- break;
- default:
- break;
- }
- }
- }
-}
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EmptyEvpnRouteTable.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EmptyEvpnRouteTable.java
deleted file mode 100644
index f49a1748ff..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EmptyEvpnRouteTable.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice.store;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.evpnrouteservice.EvpnPrefix;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteTableId;
-import org.onosproject.evpnrouteservice.EvpnTable;
-
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Route table that contains no routes.
- */
-public final class EmptyEvpnRouteTable implements EvpnTable {
-
- private final EvpnRouteTableId id = new EvpnRouteTableId("empty");
-
- private static final EmptyEvpnRouteTable INSTANCE = new EmptyEvpnRouteTable();
-
- /**
- * Returns the instance of the empty route table.
- *
- * @return empty route table
- */
- public static EmptyEvpnRouteTable instance() {
- return INSTANCE;
- }
-
- private EmptyEvpnRouteTable() {
- }
-
- @Override
- public void update(EvpnRoute route) {
-
- }
-
- @Override
- public void remove(EvpnRoute route) {
-
- }
-
- @Override
- public EvpnRouteTableId id() {
- return id;
- }
-
- @Override
- public Collection getRoutes() {
- return Collections.emptyList();
- }
-
- @Override
- public EvpnRouteSet getRoutes(EvpnPrefix prefix) {
- return null;
- }
-
- @Override
- public Collection getRoutesForNextHop(IpAddress nextHop) {
- return Collections.emptyList();
- }
-
- @Override
- public void shutdown() {
-
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EvpnRouteTable.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EvpnRouteTable.java
deleted file mode 100644
index 2c3e07be59..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/EvpnRouteTable.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnrouteservice.store;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.evpnrouteservice.EvpnInternalRouteEvent;
-import org.onosproject.evpnrouteservice.EvpnPrefix;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteStoreDelegate;
-import org.onosproject.evpnrouteservice.EvpnRouteTableId;
-import org.onosproject.evpnrouteservice.EvpnTable;
-import org.onosproject.evpnrouteservice.Label;
-import org.onosproject.evpnrouteservice.RouteDistinguisher;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.ConsistentMap;
-import org.onosproject.store.service.DistributedPrimitive;
-import org.onosproject.store.service.MapEvent;
-import org.onosproject.store.service.MapEventListener;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.Versioned;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Default implementation of a route table based on a consistent map.
- */
-public class EvpnRouteTable implements EvpnTable {
-
- private final EvpnRouteTableId id;
- private final ConsistentMap> routes;
- private final EvpnRouteStoreDelegate delegate;
- private final ExecutorService executor;
- private final RouteTableListener listener = new RouteTableListener();
-
- private final Consumer statusChangeListener;
-
- /**
- * Creates a new route table.
- *
- * @param id route table ID
- * @param delegate route store delegate to notify of events
- * @param storageService storage service
- * @param executor executor service
- */
- public EvpnRouteTable(EvpnRouteTableId id, EvpnRouteStoreDelegate delegate,
- StorageService storageService, ExecutorService executor) {
- this.delegate = checkNotNull(delegate);
- this.id = checkNotNull(id);
- this.routes = buildRouteMap(checkNotNull(storageService));
- this.executor = checkNotNull(executor);
-
- statusChangeListener = status -> {
- if (status.equals(DistributedPrimitive.Status.ACTIVE)) {
- executor.execute(this::notifyExistingRoutes);
- }
- };
- routes.addStatusChangeListener(statusChangeListener);
-
- notifyExistingRoutes();
-
- routes.addListener(listener);
- }
-
- private void notifyExistingRoutes() {
- routes.entrySet().stream()
- .map(e -> new EvpnInternalRouteEvent(
- EvpnInternalRouteEvent.Type.ROUTE_ADDED,
- new EvpnRouteSet(id, e.getKey(), e.getValue().value())))
- .forEach(delegate::notify);
- }
-
- private ConsistentMap> buildRouteMap(StorageService
- storageService) {
- KryoNamespace routeTableSerializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(KryoNamespaces.MISC)
- .register(EvpnRoute.class)
- .register(EvpnPrefix.class)
- .register(RouteDistinguisher.class)
- .register(MacAddress.class)
- .register(IpPrefix.class)
- .register(EvpnRoute.Source.class)
- .register(IpAddress.class)
- .register(VpnRouteTarget.class)
- .register(Label.class)
- .register(EvpnRouteTableId.class)
- .build();
- return storageService.>consistentMapBuilder()
- .withName("onos-evpn-routes-" + id.name())
- .withRelaxedReadConsistency()
- .withSerializer(Serializer.using(routeTableSerializer))
- .build();
- }
-
- @Override
- public EvpnRouteTableId id() {
- return id;
- }
-
- @Override
- public void shutdown() {
- routes.removeStatusChangeListener(statusChangeListener);
- routes.removeListener(listener);
- }
-
- @Override
- public void destroy() {
- shutdown();
- routes.destroy();
- }
-
- @Override
- public void update(EvpnRoute route) {
- routes.compute(route.evpnPrefix(), (prefix, set) -> {
- if (set == null) {
- set = new HashSet<>();
- }
- set.add(route);
- return set;
- });
- }
-
- @Override
- public void remove(EvpnRoute route) {
- routes.compute(route.evpnPrefix(), (prefix, set) -> {
- if (set != null) {
- set.remove(route);
- if (set.isEmpty()) {
- return null;
- }
- return set;
- }
- return null;
- });
- }
-
- @Override
- public Collection getRoutes() {
- return routes.entrySet().stream()
- .map(e -> new EvpnRouteSet(id, e.getKey(), e.getValue().value()))
- .collect(Collectors.toSet());
- }
-
- @Override
- public EvpnRouteSet getRoutes(EvpnPrefix prefix) {
- Versioned> routeSet = routes.get(prefix);
-
- if (routeSet != null) {
- return new EvpnRouteSet(id, prefix, routeSet.value());
- }
- return null;
- }
-
- @Override
- public Collection getRoutesForNextHop(IpAddress nextHop) {
- // TODO index
- return routes.values().stream()
- .flatMap(v -> v.value().stream())
- .filter(r -> r.nextHop().equals(nextHop))
- .collect(Collectors.toSet());
- }
-
- private class RouteTableListener
- implements MapEventListener> {
-
- private EvpnInternalRouteEvent createRouteEvent(
- EvpnInternalRouteEvent.Type type, MapEvent>
- event) {
- Set currentRoutes =
- (event.newValue() == null) ? Collections.emptySet() : event.newValue().value();
- return new EvpnInternalRouteEvent(type, new EvpnRouteSet(id, event
- .key(), currentRoutes));
- }
-
- @Override
- public void event(MapEvent> event) {
- EvpnInternalRouteEvent ire = null;
- switch (event.type()) {
- case INSERT:
- ire = createRouteEvent(EvpnInternalRouteEvent.Type.ROUTE_ADDED, event);
- break;
- case UPDATE:
- if (event.newValue().value().size() > event.oldValue().value().size()) {
- ire = createRouteEvent(EvpnInternalRouteEvent.Type.ROUTE_ADDED, event);
- } else {
- ire = createRouteEvent(EvpnInternalRouteEvent.Type.ROUTE_REMOVED, event);
- }
- break;
- case REMOVE:
- ire = createRouteEvent(EvpnInternalRouteEvent.Type.ROUTE_REMOVED, event);
- break;
- default:
- break;
- }
- if (ire != null) {
- delegate.notify(ire);
- }
- }
- }
-
-}
-
diff --git a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/package-info.java b/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/package-info.java
deleted file mode 100644
index 52e9d6ca7f..0000000000
--- a/apps/evpn-route-service/app/src/main/java/org/onosproject/evpnrouteservice/store/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Implementation of the unicast routing service.
- */
-package org.onosproject.evpnrouteservice.store;
diff --git a/apps/evpnopenflow/BUILD b/apps/evpnopenflow/BUILD
deleted file mode 100644
index 9e83f909d3..0000000000
--- a/apps/evpnopenflow/BUILD
+++ /dev/null
@@ -1,28 +0,0 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [
- "//apps/tunnel/api:onos-apps-tunnel-api",
- "//core/store/serializers:onos-core-serializers",
- "//apps/gluon:onos-apps-gluon",
- "//apps/vtn/vtnrsc:onos-apps-vtn-vtnrsc",
- "//apps/route-service/api:onos-apps-route-service-api",
- "//apps/evpn-route-service/api:onos-apps-evpn-route-service-api",
-]
-
-osgi_jar_with_tests(
- karaf_command_packages = ["org.onosproject.evpnopenflow.rsc.cli"],
- deps = COMPILE_DEPS,
-)
-
-onos_app(
- category = "Traffic Engineering",
- description = "Ethernet VPN (EVPN) introduces a new model for Ethernet services delivery." +
- "It enables integrated Layer 2 service over Ethernet with multihoming.",
- required_apps = [
- "org.onosproject.route-service",
- "org.onosproject.evpn-route-service",
- "org.onosproject.gluon",
- "org.onosproject.tunnel",
- "org.onosproject.vtn",
- ],
- title = "EVPN OpenFlow",
- url = "http://onosproject.org",
-)
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/EvpnService.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/EvpnService.java
deleted file mode 100644
index 5a4145457a..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/EvpnService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.manager;
-
-import org.onosproject.evpnopenflow.rsc.VpnPort;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.net.Host;
-
-/**
- * Service for interacting with the route and host events.
- */
-public interface EvpnService {
- /**
- * Transfer remote route to private route and set mpls flows out when
- * BgpRoute update.
- *
- * @param route evpn route
- */
- void onBgpEvpnRouteUpdate(EvpnRoute route);
-
- /**
- * Transfer remote route to private route and delete mpls flows out when
- * BgpRoute delete.
- *
- * @param route evpn route
- */
- void onBgpEvpnRouteDelete(EvpnRoute route);
-
- /**
- * Get VPN info from EVPN app store and create route, set flows when host
- * detected.
- *
- * @param host host information
- */
- void onHostDetected(Host host);
-
- /**
- * Get VPN info from EVPN app store and delete route, set flows when
- * host
- * vanished.
- *
- * @param host host information
- */
- void onHostVanished(Host host);
-
- /**
- * Get VPN info from EVPN app store and create route, set flows when
- * host
- * detected.
- *
- * @param vpnPort vpnPort information
- */
- void onVpnPortSet(VpnPort vpnPort);
-
- /**
- * Get VPN info from EVPN app store and delete route, set flows when host
- * vanished.
- *
- * @param vpnPort vpnPort information
- */
- void onVpnPortDelete(VpnPort vpnPort);
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
deleted file mode 100644
index edfbfd0c61..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/EvpnManager.java
+++ /dev/null
@@ -1,1130 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.manager.impl;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.packet.EthType;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MplsLabel;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.evpnopenflow.manager.EvpnService;
-import org.onosproject.evpnopenflow.rsc.VpnAfConfig;
-import org.onosproject.evpnopenflow.rsc.VpnInstance;
-import org.onosproject.evpnopenflow.rsc.VpnInstanceId;
-import org.onosproject.evpnopenflow.rsc.VpnPort;
-import org.onosproject.evpnopenflow.rsc.VpnPortId;
-import org.onosproject.evpnopenflow.rsc.baseport.BasePortService;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigEvent;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigListener;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigService;
-import org.onosproject.evpnopenflow.rsc.vpninstance.VpnInstanceService;
-import org.onosproject.evpnopenflow.rsc.vpnport.VpnPortEvent;
-import org.onosproject.evpnopenflow.rsc.vpnport.VpnPortListener;
-import org.onosproject.evpnopenflow.rsc.vpnport.VpnPortService;
-import org.onosproject.evpnrouteservice.EvpnInstanceName;
-import org.onosproject.evpnrouteservice.EvpnInstanceNextHop;
-import org.onosproject.evpnrouteservice.EvpnInstancePrefix;
-import org.onosproject.evpnrouteservice.EvpnInstanceRoute;
-import org.onosproject.evpnrouteservice.EvpnNextHop;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRoute.Source;
-import org.onosproject.evpnrouteservice.EvpnRouteAdminService;
-import org.onosproject.evpnrouteservice.EvpnRouteEvent;
-import org.onosproject.evpnrouteservice.EvpnRouteListener;
-import org.onosproject.evpnrouteservice.EvpnRouteService;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteStore;
-import org.onosproject.evpnrouteservice.Label;
-import org.onosproject.evpnrouteservice.RouteDistinguisher;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-import org.onosproject.gluon.rsc.GluonConfig;
-import org.onosproject.incubator.net.resource.label.LabelResource;
-import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
-import org.onosproject.incubator.net.resource.label.LabelResourceId;
-import org.onosproject.incubator.net.resource.label.LabelResourceService;
-import org.onosproject.mastership.MastershipService;
-import org.onosproject.net.AnnotationKeys;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
-import org.onosproject.net.config.NetworkConfigEvent;
-import org.onosproject.net.config.NetworkConfigListener;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.driver.DriverService;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.instructions.ExtensionTreatment;
-import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.flowobjective.Objective.Operation;
-import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.host.HostListener;
-import org.onosproject.net.host.HostService;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.APP_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ARP_PRIORITY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ARP_RESPONSE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.BASEPORT;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.BGP_EVPN_ROUTE_DELETE_START;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.BGP_EVPN_ROUTE_UPDATE_START;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.BOTH;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.CANNOT_FIND_TUNNEL_PORT_DEVICE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.CANT_FIND_CONTROLLER_DEVICE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.CANT_FIND_VPN_INSTANCE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.CANT_FIND_VPN_PORT;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DELETE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_OPENFLOW_START;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_OPENFLOW_STOP;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EXPORT_EXTCOMMUNITY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.FAILED_TO_SET_TUNNEL_DST;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.GET_PRIVATE_LABEL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.HOST_DETECT;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.HOST_VANISHED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IFACEID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IFACEID_OF_HOST_IS_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IMPORT_EXTCOMMUNITY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INVALID_EVENT_RECEIVED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INVALID_ROUTE_TARGET_TYPE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INVALID_TARGET_RECEIVED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.MPLS_OUT_FLOWS;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.NETWORK_CONFIG_EVENT_IS_RECEIVED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.NOT_MASTER_FOR_SPECIFIC_DEVICE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RELEASE_LABEL_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_ADD_ARP_RULES;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_REMOVE_ARP_RULES;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SLASH;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SWITCH_CHANNEL_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.TUNNEL_DST;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.UPDATE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_TARGET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_TARGET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_PORT_BIND;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_PORT_TARGET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_PORT_UNBIND;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VXLAN;
-import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Implementation of the EVPN service.
- */
-@Component(immediate = true, service = EvpnService.class)
-public class EvpnManager implements EvpnService {
- private final Logger log = getLogger(getClass());
- private static final EthType.EtherType ARP_TYPE = EthType.EtherType.ARP;
-
- protected ApplicationId appId;
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected HostService hostService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected EvpnRouteService evpnRouteService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected EvpnRouteStore evpnRouteStore;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected DeviceService deviceService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected EvpnRouteAdminService evpnRouteAdminService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected MastershipService mastershipService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected LabelResourceAdminService labelAdminService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected LabelResourceService labelService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected VpnInstanceService vpnInstanceService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected FlowObjectiveService flowObjectiveService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected DriverService driverService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected VpnPortService vpnPortService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected VpnAfConfigService vpnAfConfigService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected NetworkConfigService configService;
-
- public Set evpnInstanceRoutes = new HashSet<>();
- private final HostListener hostListener = new InnerHostListener();
- private final VpnPortListener vpnPortListner = new InnerVpnPortListener();
- private final VpnAfConfigListener vpnAfConfigListener = new
- InnerVpnAfConfigListener();
- private final InternalRouteEventListener routeListener = new
- InternalRouteEventListener();
-
- private final NetworkConfigListener configListener = new
- InternalNetworkConfigListener();
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(APP_ID);
- hostService.addListener(hostListener);
- vpnPortService.addListener(vpnPortListner);
- vpnAfConfigService.addListener(vpnAfConfigListener);
- configService.addListener(configListener);
- evpnRouteService.addListener(routeListener);
-
- labelAdminService
- .createGlobalPool(LabelResourceId.labelResourceId(1),
- LabelResourceId.labelResourceId(1000));
- log.info(EVPN_OPENFLOW_START);
- }
-
- @Deactivate
- public void deactivate() {
- hostService.removeListener(hostListener);
- vpnPortService.removeListener(vpnPortListner);
- vpnAfConfigService.removeListener(vpnAfConfigListener);
- configService.removeListener(configListener);
- log.info(EVPN_OPENFLOW_STOP);
- }
-
- @Override
- public void onBgpEvpnRouteUpdate(EvpnRoute route) {
- if (EvpnRoute.Source.LOCAL.equals(route.source())) {
- return;
- }
- log.info(BGP_EVPN_ROUTE_UPDATE_START, route);
- // deal with public route and transfer to private route
- if (vpnInstanceService.getInstances().isEmpty()) {
- log.info("unable to get instnaces from vpninstance");
- return;
- }
-
- vpnInstanceService.getInstances().forEach(vpnInstance -> {
- log.info("got instnaces from vpninstance but not entered here");
- List vpnImportRouteRt = new
- LinkedList<>(vpnInstance.getImportRouteTargets());
- List expRt = route.exportRouteTarget();
- List similar = new LinkedList<>(expRt);
- similar.retainAll(vpnImportRouteRt);
-
- if (!similar.isEmpty()) {
- EvpnInstancePrefix evpnPrefix = EvpnInstancePrefix
- .evpnPrefix(route.prefixMac(), route.prefixIp());
-
- EvpnInstanceNextHop evpnNextHop = EvpnInstanceNextHop
- .evpnNextHop(route.ipNextHop(), route.label());
-
- EvpnInstanceRoute evpnPrivateRoute = new
- EvpnInstanceRoute(vpnInstance.vpnInstanceName(),
- route.routeDistinguisher(),
- vpnImportRouteRt,
- route.exportRouteTarget(),
- evpnPrefix,
- evpnNextHop,
- route.prefixIp(),
- route.ipNextHop(),
- route.label());
-
- //update route in route subsystem
- //TODO: added by shahid
- evpnInstanceRoutes.add(evpnPrivateRoute);
-
- }
- });
-
- deviceService.getAvailableDevices(Device.Type.SWITCH)
- .forEach(device -> {
- log.info("switch device is found");
- Set hosts = getHostsByVpn(device, route);
- for (Host h : hosts) {
- addArpFlows(device.id(),
- route,
- Objective.Operation.ADD,
- h);
- ForwardingObjective.Builder objective =
- getMplsOutBuilder(device.id(),
- route,
- h);
- log.info(MPLS_OUT_FLOWS, h);
- flowObjectiveService.forward(device.id(),
- objective.add());
- }
- });
- log.info("no switch device is found");
- }
-
- @Override
- public void onBgpEvpnRouteDelete(EvpnRoute route) {
- if (EvpnRoute.Source.LOCAL.equals(route.source())) {
- return;
- }
- log.info(BGP_EVPN_ROUTE_DELETE_START, route);
- // deal with public route deleted and transfer to private route
- vpnInstanceService.getInstances().forEach(vpnInstance -> {
- List vpnRouteRt = new
- LinkedList<>(vpnInstance.getImportRouteTargets());
- List localRt = route.exportRouteTarget();
- List similar = new LinkedList<>(localRt);
- similar.retainAll(vpnRouteRt);
-
- if (!similar.isEmpty()) {
- EvpnInstancePrefix evpnPrefix = EvpnInstancePrefix
- .evpnPrefix(route.prefixMac(), route.prefixIp());
-
- EvpnInstanceNextHop evpnNextHop = EvpnInstanceNextHop
- .evpnNextHop(route.ipNextHop(), route.label());
-
- EvpnInstanceRoute evpnPrivateRoute = new
- EvpnInstanceRoute(vpnInstance.vpnInstanceName(),
- route.routeDistinguisher(),
- vpnRouteRt,
- route.exportRouteTarget(),
- evpnPrefix,
- evpnNextHop,
- route.prefixIp(),
- route.ipNextHop(),
- route.label());
- //TODO: Added by Shahid
- //evpnRouteAdminService.withdraw(Sets.newHashSet
- // (evpnPrivateRoute));
-
- }
- });
- deviceService.getAvailableDevices(Device.Type.SWITCH)
- .forEach(device -> {
- Set hosts = getHostsByVpn(device, route);
- for (Host h : hosts) {
- addArpFlows(device.id(),
- route,
- Objective.Operation.REMOVE,
- h);
- ForwardingObjective.Builder objective
- = getMplsOutBuilder(device.id(),
- route,
- h);
- flowObjectiveService.forward(device.id(),
- objective.remove());
- }
- });
- }
-
- private void addArpFlows(DeviceId deviceId,
- EvpnRoute route,
- Operation type,
- Host host) {
- DriverHandler handler = driverService.createHandler(deviceId);
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(ARP_TYPE.ethType().toShort())
- .matchArpTpa(route.prefixIp().address().getIp4Address())
- .matchInPort(host.location().port()).build();
-
- ExtensionTreatmentResolver resolver = handler
- .behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment ethSrcToDst = resolver
- .getExtensionInstruction(ExtensionTreatmentType
- .ExtensionTreatmentTypes
- .NICIRA_MOV_ETH_SRC_TO_DST
- .type());
- ExtensionTreatment arpShaToTha = resolver
- .getExtensionInstruction(ExtensionTreatmentType
- .ExtensionTreatmentTypes
- .NICIRA_MOV_ARP_SHA_TO_THA
- .type());
- ExtensionTreatment arpSpaToTpa = resolver
- .getExtensionInstruction(ExtensionTreatmentType
- .ExtensionTreatmentTypes
- .NICIRA_MOV_ARP_SPA_TO_TPA
- .type());
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .extension(ethSrcToDst, deviceId).setEthSrc(route.prefixMac())
- .setArpOp(ARP_RESPONSE).extension(arpShaToTha, deviceId)
- .extension(arpSpaToTpa, deviceId).setArpSha(route.prefixMac())
- .setArpSpa(route.prefixIp().address().getIp4Address())
- .setOutput(PortNumber.IN_PORT)
- .build();
-
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(ForwardingObjective.Flag.SPECIFIC)
- .withPriority(ARP_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.info(ROUTE_ADD_ARP_RULES);
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.info(ROUTE_REMOVE_ARP_RULES);
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
- private Set getHostsByVpn(Device device, EvpnRoute route) {
- Set vpnHosts = Sets.newHashSet();
- Set hosts = hostService.getConnectedHosts(device.id());
- for (Host h : hosts) {
- String ifaceId = h.annotations().value(IFACEID);
- if (!vpnPortService.exists(VpnPortId.vpnPortId(ifaceId))) {
- continue;
- }
-
- VpnPort vpnPort = vpnPortService
- .getPort(VpnPortId.vpnPortId(ifaceId));
- VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
-
- VpnInstance vpnInstance = vpnInstanceService
- .getInstance(vpnInstanceId);
-
- List expRt = route.exportRouteTarget();
- List similar = new LinkedList<>(expRt);
- similar.retainAll(vpnInstance.getImportRouteTargets());
- //TODO: currently checking for RT comparison.
- //TODO: Need to check about RD comparison is really required.
- //if (route.routeDistinguisher()
- //.equals(vpnInstance.routeDistinguisher())) {
- if (!similar.isEmpty()) {
- vpnHosts.add(h);
- }
- }
- return vpnHosts;
- }
-
- private ForwardingObjective.Builder getMplsOutBuilder(DeviceId deviceId,
- EvpnRoute route,
- Host h) {
- DriverHandler handler = driverService.createHandler(deviceId);
- ExtensionTreatmentResolver resolver = handler
- .behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment treatment = resolver
- .getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
- try {
- treatment.setPropertyValue(TUNNEL_DST, route.ipNextHop());
- } catch (Exception e) {
- log.error(FAILED_TO_SET_TUNNEL_DST, deviceId);
- }
- TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
- builder.extension(treatment, deviceId);
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(h.location().port()).matchEthSrc(h.mac())
- .matchEthDst(route.prefixMac()).build();
-
- TrafficTreatment build = builder.pushMpls()
- .setMpls(MplsLabel.mplsLabel(route.label().getLabel()))
- .setOutput(getTunnlePort(deviceId)).build();
-
- return DefaultForwardingObjective
- .builder().withTreatment(build).withSelector(selector)
- .fromApp(appId).withFlag(ForwardingObjective.Flag.SPECIFIC)
- .withPriority(60000);
-
- }
-
- private ForwardingObjective.Builder getMplsInBuilder(DeviceId deviceId,
- Host host,
- Label label) {
- TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(getTunnlePort(deviceId))
- .matchEthType(EthType.EtherType.MPLS_UNICAST.ethType()
- .toShort())
- .matchMplsBos(true)
- .matchMplsLabel(MplsLabel.mplsLabel(label.getLabel())).build();
- TrafficTreatment treatment = builder.popMpls(EthType
- .EtherType
- .IPV4.ethType())
- .setOutput(host.location().port()).build();
- return DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(ForwardingObjective.Flag.SPECIFIC)
- .withPriority(60000);
- }
-
- /**
- * Get local tunnel ports.
- *
- * @param ports Iterable of Port
- * @return Collection of PortNumber
- */
- private Collection getLocalTunnelPorts(Iterable
- ports) {
- Collection localTunnelPorts = new ArrayList<>();
- if (ports != null) {
- log.info("port value is not null {}", ports);
- Sets.newHashSet(ports).stream()
- .filter(p -> !p.number().equals(PortNumber.LOCAL))
- .forEach(p -> {
- log.info("number is not matched but no vxlan port");
- if (p.annotations().value(AnnotationKeys.PORT_NAME)
- .startsWith(VXLAN)) {
- localTunnelPorts.add(p.number());
- }
- });
- }
- return localTunnelPorts;
- }
-
- private PortNumber getTunnlePort(DeviceId deviceId) {
- Iterable ports = deviceService.getPorts(deviceId);
- Collection localTunnelPorts = getLocalTunnelPorts(ports);
- if (localTunnelPorts.isEmpty()) {
- log.error(CANNOT_FIND_TUNNEL_PORT_DEVICE, deviceId);
- return null;
- }
- return localTunnelPorts.iterator().next();
- }
-
- private void setFlows(DeviceId deviceId, Host host, Label label,
- List rtImport,
- Operation type) {
- log.info("Set the flows to OVS");
- ForwardingObjective.Builder objective = getMplsInBuilder(deviceId,
- host,
- label);
- if (type.equals(Objective.Operation.ADD)) {
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- flowObjectiveService.forward(deviceId, objective.remove());
- }
-
- // download remote flows if and only routes are present.
- evpnRouteStore.getRouteTables().forEach(routeTableId -> {
- Collection routes
- = evpnRouteStore.getRoutes(routeTableId);
- if (routes != null) {
- routes.forEach(route -> {
- Collection evpnRoutes = route.routes();
- for (EvpnRoute evpnRoute : evpnRoutes) {
- EvpnRoute evpnRouteTem = evpnRoute;
- Set hostByMac = hostService
- .getHostsByMac(evpnRouteTem
- .prefixMac());
-
- if (!hostByMac.isEmpty()
- || (!(compareLists(rtImport, evpnRouteTem
- .exportRouteTarget())))) {
- log.info("Route target import/export is not matched");
- continue;
- }
- log.info("Set the ARP flows");
- addArpFlows(deviceId, evpnRouteTem, type, host);
- ForwardingObjective.Builder build = getMplsOutBuilder(deviceId,
- evpnRouteTem,
- host);
- log.info("Set the MPLS flows");
- if (type.equals(Objective.Operation.ADD)) {
- flowObjectiveService.forward(deviceId, build.add());
- } else {
- flowObjectiveService.forward(deviceId, build.remove());
- }
- }
- });
- }
- });
- }
-
- /**
- * comparison for tow lists.
- *
- * @param list1 import list
- * @param list2 export list
- * @return true or false
- */
- public static boolean compareLists(List list1,
- List list2) {
- if (list1 == null && list2 == null) {
- return true;
- }
-
- if (list1 != null && list2 != null) {
- if (list1.size() == list2.size()) {
- for (VpnRouteTarget li1Long : list1) {
- boolean isEqual = false;
- for (VpnRouteTarget li2Long : list2) {
- if (li1Long.equals(li2Long)) {
- isEqual = true;
- break;
- }
- }
- if (!isEqual) {
- return false;
- }
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- return true;
- }
-
- @Override
- public void onHostDetected(Host host) {
- log.info(HOST_DETECT, host);
- DeviceId deviceId = host.location().deviceId();
- if (!mastershipService.isLocalMaster(deviceId)) {
- log.info(NOT_MASTER_FOR_SPECIFIC_DEVICE);
- return;
- }
-
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error(IFACEID_OF_HOST_IS_NULL);
- return;
- }
- VpnPortId vpnPortId = VpnPortId.vpnPortId(ifaceId);
- // Get VPN port id from EVPN app store
- if (!vpnPortService.exists(vpnPortId)) {
- log.info(CANT_FIND_VPN_PORT, ifaceId);
- return;
- }
-
- VpnPort vpnPort = vpnPortService.getPort(vpnPortId);
- VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
- if (!vpnInstanceService.exists(vpnInstanceId)) {
- log.info(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
- return;
- }
-
- Label privateLabel = applyLabel();
- // create private route and get label
- setPrivateRoute(host, vpnInstanceId, privateLabel,
- Objective.Operation.ADD);
- VpnInstance vpnInstance = vpnInstanceService.getInstance(vpnInstanceId);
-
- List rtImport
- = new LinkedList<>(vpnInstance.getImportRouteTargets());
- List rtExport
- = new LinkedList<>(vpnInstance.getExportRouteTargets());
- //download flows
- setFlows(deviceId, host, privateLabel, rtImport,
- Objective.Operation.ADD);
- }
-
- /**
- * update or withdraw evpn route from route admin service.
- *
- * @param host host
- * @param vpnInstanceId vpn instance id
- * @param privateLabel private label
- * @param type operation type
- */
- private void setPrivateRoute(Host host, VpnInstanceId vpnInstanceId,
- Label privateLabel,
- Operation type) {
- DeviceId deviceId = host.location().deviceId();
- Device device = deviceService.getDevice(deviceId);
- VpnInstance vpnInstance = vpnInstanceService.getInstance(vpnInstanceId);
- RouteDistinguisher rd = vpnInstance.routeDistinguisher();
- Set importRouteTargets
- = vpnInstance.getImportRouteTargets();
- Set exportRouteTargets
- = vpnInstance.getExportRouteTargets();
- EvpnInstanceName instanceName = vpnInstance.vpnInstanceName();
- String url = device.annotations().value(SWITCH_CHANNEL_ID);
- String controllerIp = url.substring(0, url.lastIndexOf(":"));
-
- if (controllerIp == null) {
- log.error(CANT_FIND_CONTROLLER_DEVICE, device.id().toString());
- return;
- }
- IpAddress ipAddress = IpAddress.valueOf(controllerIp);
- // create private route
- EvpnInstanceNextHop evpnNextHop = EvpnInstanceNextHop
- .evpnNextHop(ipAddress, privateLabel);
- EvpnInstancePrefix evpnPrefix = EvpnInstancePrefix
- .evpnPrefix(host.mac(), IpPrefix.valueOf(host.ipAddresses()
- .iterator()
- .next()
- .getIp4Address(), 32));
- EvpnInstanceRoute evpnPrivateRoute
- = new EvpnInstanceRoute(instanceName,
- rd,
- new LinkedList<>(importRouteTargets),
- new LinkedList<>(exportRouteTargets),
- evpnPrefix,
- evpnNextHop,
- IpPrefix.valueOf(host.ipAddresses()
- .iterator()
- .next()
- .getIp4Address(), 32),
- ipAddress,
- privateLabel);
-
- // change to public route
- EvpnRoute evpnRoute
- = new EvpnRoute(Source.LOCAL,
- host.mac(),
- IpPrefix.valueOf(host.ipAddresses()
- .iterator()
- .next()
- .getIp4Address(), 32),
- ipAddress,
- rd,
- new LinkedList<>(importRouteTargets),
- new LinkedList<>(exportRouteTargets),
- privateLabel);
- if (type.equals(Objective.Operation.ADD)) {
- //evpnRouteAdminService.update(Sets.newHashSet(evpnPrivateRoute));
- evpnInstanceRoutes.add(evpnPrivateRoute);
- evpnRouteAdminService.update(Sets.newHashSet(evpnRoute));
-
- } else {
- //evpnRouteAdminService.withdraw(Sets.newHashSet(evpnPrivateRoute));
- evpnInstanceRoutes.remove(evpnPrivateRoute);
- evpnRouteAdminService.withdraw(Sets.newHashSet(evpnRoute));
- }
- }
-
- /**
- * Generate the label for evpn route from global pool.
- */
- private Label applyLabel() {
- Collection privateLabels = labelService
- .applyFromGlobalPool(1);
- Label privateLabel = Label.label(0);
- if (!privateLabels.isEmpty()) {
- privateLabel = Label.label(Integer.parseInt(
- privateLabels.iterator().next()
- .labelResourceId().toString()));
- }
- log.info(GET_PRIVATE_LABEL, privateLabel);
- return privateLabel;
- }
-
- @Override
- public void onHostVanished(Host host) {
- log.info(HOST_VANISHED, host);
- DeviceId deviceId = host.location().deviceId();
- if (!mastershipService.isLocalMaster(deviceId)) {
- return;
- }
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error(IFACEID_OF_HOST_IS_NULL);
- return;
- }
- // Get info from Gluon Shim
- VpnPort vpnPort = vpnPortService.getPort(VpnPortId.vpnPortId(ifaceId));
- VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
- if (!vpnInstanceService.exists(vpnInstanceId)) {
- log.info(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
- return;
- }
- VpnInstance vpnInstance = vpnInstanceService.getInstance(vpnInstanceId);
-
- Label label = releaseLabel(vpnInstance, host);
- // create private route and get label
- setPrivateRoute(host, vpnInstanceId, label, Objective.Operation.REMOVE);
- // download flows
- List rtImport
- = new LinkedList<>(vpnInstance.getImportRouteTargets());
- List rtExport
- = new LinkedList<>(vpnInstance.getExportRouteTargets());
- setFlows(deviceId, host, label, rtImport,
- Objective.Operation.REMOVE);
- }
-
- /**
- * Release the label from the evpn route.
- *
- * @param vpnInstance vpn instance
- * @param host host
- */
- private Label releaseLabel(VpnInstance vpnInstance, Host host) {
- EvpnInstanceName instanceName = vpnInstance.vpnInstanceName();
-
- //Get all vpn-instance routes and check for label.
- Label label = null;
- for (EvpnInstanceRoute evpnInstanceRoute : evpnInstanceRoutes) {
- if (evpnInstanceRoute.evpnInstanceName().equals(instanceName)) {
- label = evpnInstanceRoute.getLabel();
- // delete private route and get label ,change to public route
- boolean isRelease
- = labelService
- .releaseToGlobalPool(
- Sets.newHashSet(
- LabelResourceId
- .labelResourceId(label.getLabel())));
- if (!isRelease) {
- log.error(RELEASE_LABEL_FAILED, label.getLabel());
- }
- break;
- }
- }
- return label;
- }
-
- private class InternalRouteEventListener implements EvpnRouteListener {
-
- @Override
- public void event(EvpnRouteEvent event) {
- if (event.subject() != null) {
- EvpnRoute route = (EvpnRoute) event.subject();
- if (EvpnRouteEvent.Type.ROUTE_ADDED == event.type()) {
- onBgpEvpnRouteUpdate(route);
- } else if (EvpnRouteEvent.Type.ROUTE_REMOVED == event.type()) {
- onBgpEvpnRouteDelete(route);
- }
- } else {
- return;
- }
- }
- }
-
- private class InnerHostListener implements HostListener {
-
- @Override
- public void event(HostEvent event) {
- Host host = event.subject();
- if (HostEvent.Type.HOST_ADDED == event.type()) {
- onHostDetected(host);
- } else if (HostEvent.Type.HOST_REMOVED == event.type()) {
- onHostVanished(host);
- }
- }
-
- }
-
- private class InnerVpnPortListener implements VpnPortListener {
-
- @Override
- public void event(VpnPortEvent event) {
- VpnPort vpnPort = event.subject();
- if (VpnPortEvent.Type.VPN_PORT_DELETE == event.type()) {
- onVpnPortDelete(vpnPort);
- } else if (VpnPortEvent.Type.VPN_PORT_SET == event.type()) {
- onVpnPortSet(vpnPort);
- }
- }
- }
-
- @Override
- public void onVpnPortDelete(VpnPort vpnPort) {
- // delete the flows of this vpn
- hostService.getHosts().forEach(host -> {
- VpnPortId vpnPortId = vpnPort.id();
- VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
- if (!vpnInstanceService.exists(vpnInstanceId)) {
- log.error(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
- return;
- }
- VpnInstance vpnInstance = vpnInstanceService
- .getInstance(vpnInstanceId);
- List rtImport
- = new LinkedList<>(vpnInstance.getImportRouteTargets());
- List rtExport
- = new LinkedList<>(vpnInstance.getExportRouteTargets());
-
- if (vpnPortId.vpnPortId()
- .equals(host.annotations().value(IFACEID))) {
- log.info(VPN_PORT_UNBIND);
- Label label = releaseLabel(vpnInstance, host);
- // create private route and get label
- DeviceId deviceId = host.location().deviceId();
- setPrivateRoute(host, vpnInstanceId, label,
- Objective.Operation.REMOVE);
- // download flows
- setFlows(deviceId, host, label, rtImport,
- Objective.Operation.REMOVE);
- }
- });
- }
-
- @Override
- public void onVpnPortSet(VpnPort vpnPort) {
- // delete the flows of this vpn
- hostService.getHosts().forEach(host -> {
- VpnPortId vpnPortId = vpnPort.id();
- VpnInstanceId vpnInstanceId = vpnPort.vpnInstanceId();
- VpnInstance vpnInstance = vpnInstanceService
- .getInstance(vpnInstanceId);
- if (vpnInstance == null) {
- log.info("why vpn instance is null");
- return;
- }
- List rtImport
- = new LinkedList<>(vpnInstance.getImportRouteTargets());
-/* List rtExport
- = new LinkedList<>(vpnInstance.getExportRouteTargets());*/
-
- if (!vpnInstanceService.exists(vpnInstanceId)) {
- log.error(CANT_FIND_VPN_INSTANCE, vpnInstanceId);
- return;
- }
-
- if (vpnPortId.vpnPortId()
- .equals(host.annotations().value(IFACEID))) {
- log.info(VPN_PORT_BIND);
- Label label = applyLabel();
- // create private route and get label
- DeviceId deviceId = host.location().deviceId();
- setPrivateRoute(host, vpnInstanceId, label,
- Objective.Operation.ADD);
- // download flows
- setFlows(deviceId, host, label, rtImport,
- Objective.Operation.ADD);
- }
- });
- }
-
- /**
- * process the gluon configuration and will update the configuration into
- * vpn port service.
- *
- * @param action action
- * @param key key
- * @param value json node
- */
- private void processEtcdResponse(String action, String key, JsonNode
- value) {
- String[] list = key.split(SLASH);
- String target = list[list.length - 2];
- switch (target) {
- case VPN_INSTANCE_TARGET:
- VpnInstanceService vpnInstanceService
- = DefaultServiceDirectory
- .getService(VpnInstanceService.class);
- vpnInstanceService.processGluonConfig(action, key, value);
- break;
- case VPN_PORT_TARGET:
- VpnPortService vpnPortService = DefaultServiceDirectory
- .getService(VpnPortService.class);
- vpnPortService.processGluonConfig(action, key, value);
- break;
- case VPN_AF_TARGET:
- VpnAfConfigService vpnAfConfigService =
- DefaultServiceDirectory.getService(VpnAfConfigService
- .class);
- vpnAfConfigService.processGluonConfig(action, key, value);
- break;
- case BASEPORT:
- BasePortService basePortService =
- DefaultServiceDirectory.getService(BasePortService
- .class);
- basePortService.processGluonConfig(action, key, value);
- break;
- default:
- log.info("why target type is invalid {}", target);
- log.info(INVALID_TARGET_RECEIVED);
- break;
- }
- }
-
- /**
- * parse the gluon configuration received from network config system.
- *
- * @param jsonNode json node
- * @param key key
- * @param action action
- */
- private void parseEtcdResponse(JsonNode jsonNode,
- String key,
- String action) {
- JsonNode modifyValue = null;
- if (action.equals(SET)) {
- modifyValue = jsonNode.get(key);
- }
- processEtcdResponse(action, key, modifyValue);
- }
-
- /**
- * Listener for network config events.
- */
- private class InternalNetworkConfigListener implements
- NetworkConfigListener {
-
- @Override
- public void event(NetworkConfigEvent event) {
- String subject;
- log.info(NETWORK_CONFIG_EVENT_IS_RECEIVED, event.type());
- if (!event.configClass().equals(GluonConfig.class)) {
- return;
- }
- log.info("Event is received from network configuration {}", event
- .type());
- switch (event.type()) {
- case CONFIG_UPDATED:
- subject = (String) event.subject();
- GluonConfig gluonConfig = configService
- .getConfig(subject, GluonConfig.class);
- JsonNode jsonNode = gluonConfig.node();
- parseEtcdResponse(jsonNode, subject, SET);
- break;
- case CONFIG_REMOVED:
- subject = (String) event.subject();
- parseEtcdResponse(null, subject, DELETE);
- break;
- default:
- log.info(INVALID_EVENT_RECEIVED);
- break;
- }
- }
- }
-
- /**
- * update import and export route target information in route admin service.
- *
- * @param evpnInstanceName evpn instance name
- * @param exportRouteTargets export route targets
- * @param importRouteTargets import route targets
- * @param action action holds update or delete
- */
- private void updateImpExpRtInRoute(EvpnInstanceName evpnInstanceName,
- Set exportRouteTargets,
- Set importRouteTargets,
- String action) {
-
- for (EvpnInstanceRoute evpnInstanceRoute : evpnInstanceRoutes) {
- if (evpnInstanceRoute.evpnInstanceName().equals(evpnInstanceName)) {
- evpnInstanceRoute
- .setExportRtList(new LinkedList<>(exportRouteTargets));
- evpnInstanceRoute
- .setImportRtList(new LinkedList<>(importRouteTargets));
- if (action.equals(UPDATE)) {
- evpnInstanceRoutes.add(evpnInstanceRoute);
- } else if (action.equals(DELETE)) {
- evpnInstanceRoutes.remove(evpnInstanceRoute);
- }
- //Get the public route and update route targets.
- EvpnNextHop evpnNextHop = EvpnNextHop
- .evpnNextHop(evpnInstanceRoute.getNextHopl(),
- evpnInstanceRoute.importRouteTarget(),
- evpnInstanceRoute.exportRouteTarget(),
- evpnInstanceRoute.getLabel());
- Collection evpnPublicRoutes
- = evpnRouteStore.getRoutesForNextHop(evpnNextHop.nextHop());
- for (EvpnRoute pubRoute : evpnPublicRoutes) {
- EvpnRoute evpnPubRoute = pubRoute;
- if (evpnPubRoute.label().equals(evpnInstanceRoute
- .getLabel())) {
- evpnPubRoute
- .setExportRtList(new LinkedList<>(exportRouteTargets));
- evpnPubRoute
- .setImportRtList(new LinkedList<>(importRouteTargets));
- if (action.equals(UPDATE)) {
- evpnRouteAdminService.update(Sets.newHashSet(evpnPubRoute));
- } else if (action.equals(DELETE)) {
- evpnRouteAdminService
- .withdraw(Sets.newHashSet(evpnPubRoute));
- }
- }
- }
- }
- }
- }
-
- /**
- * update or withdraw evpn route based on vpn af configuration.
- *
- * @param vpnAfConfig vpn af configuration
- * @param action action holds update or delete
- */
-
- private void processEvpnRouteUpdate(VpnAfConfig vpnAfConfig,
- String action) {
- Collection instances
- = vpnInstanceService.getInstances();
- for (VpnInstance vpnInstance : instances) {
- Set configRouteTargets
- = vpnInstance.getConfigRouteTargets();
- for (VpnRouteTarget vpnRouteTarget : configRouteTargets) {
- if (vpnRouteTarget.equals(vpnAfConfig.routeTarget())) {
- Set exportRouteTargets
- = vpnInstance.getExportRouteTargets();
- Set importRouteTargets
- = vpnInstance.getImportRouteTargets();
- String routeTargetType = vpnAfConfig.routeTargetType();
- if (action.equals(UPDATE)) {
- vpnInstanceService
- .updateImpExpRouteTargets(routeTargetType,
- exportRouteTargets,
- importRouteTargets,
- vpnRouteTarget);
- } else if (action.equals(DELETE)) {
- switch (routeTargetType) {
- case EXPORT_EXTCOMMUNITY:
- exportRouteTargets.remove(vpnRouteTarget);
- break;
- case IMPORT_EXTCOMMUNITY:
- importRouteTargets.remove(vpnRouteTarget);
- break;
- case BOTH:
- exportRouteTargets.remove(vpnRouteTarget);
- importRouteTargets.remove(vpnRouteTarget);
- break;
- default:
- log.info(INVALID_ROUTE_TARGET_TYPE);
- break;
- }
- }
- updateImpExpRtInRoute(vpnInstance.vpnInstanceName(),
- exportRouteTargets,
- importRouteTargets,
- action);
- }
- }
- }
- }
-
- private class InnerVpnAfConfigListener implements VpnAfConfigListener {
-
- @Override
- public void event(VpnAfConfigEvent event) {
- VpnAfConfig vpnAfConfig = event.subject();
- if (VpnAfConfigEvent.Type.VPN_AF_CONFIG_DELETE == event.type()) {
- processEvpnRouteUpdate(vpnAfConfig, DELETE);
- } else if (VpnAfConfigEvent.Type.VPN_AF_CONFIG_SET
- == event.type() || VpnAfConfigEvent.Type
- .VPN_AF_CONFIG_UPDATE == event.type()) {
- processEvpnRouteUpdate(vpnAfConfig, UPDATE);
- }
- }
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/package-info.java
deleted file mode 100644
index 8f831614ae..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/impl/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * EVPN application that process configuration and host, vpn-port, route
- * events.
- */
-package org.onosproject.evpnopenflow.manager.impl;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/package-info.java
deleted file mode 100644
index d93de24c8f..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/manager/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * EVPN application that process configuration and host, vpn-port, route
- * events.
- */
-package org.onosproject.evpnopenflow.manager;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePort.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePort.java
deleted file mode 100644
index 1b2455a44c..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePort.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * Representation of a Base port.
- */
-public interface BasePort {
- /**
- * Coarse classification of the type of the virtual port.
- */
- enum State {
- /**
- * Signifies that a basePort is currently active,This state mean that
- * this basePort is available.
- */
- ACTIVE,
- /**
- * Signifies that a basePort is currently unavailable.
- */
- DOWN;
- }
-
- /**
- * Returns the basePort identifier.
- *
- * @return basePort identifier
- */
- BasePortId portId();
-
- /**
- * Returns the network identifier.
- *
- * @return tenantNetwork identifier
- */
- TenantNetworkId networkId();
-
- /**
- * Returns the symbolic name for the basePort.
- *
- * @return basePort name
- */
- String name();
-
- /**
- * Returns the administrative status of the port,which is up(true) or
- * down(false).
- *
- * @return true if the administrative status of the port is up
- */
- boolean adminStateUp();
-
- /**
- * Returns the state.
- *
- * @return state
- */
- String state();
-
- /**
- * Returns the MAC address.
- *
- * @return MAC Address
- */
- MacAddress macAddress();
-
- /**
- * Returns the port tenantId.
- *
- * @return port tenantId
- */
- TenantId tenantId();
-
- /**
- * Returns the device identifier.
- *
- * @return deviceId
- */
- DeviceId deviceId();
-
- /**
- * Returns the identifier of the entity that uses this port.
- *
- * @return deviceOwner
- */
- String deviceOwner();
-
- /**
- * Returns the basePort allowedAddressPairs.
- *
- * @return basePort allowedAddressPairs
- */
- Collection allowedAddressPairs();
-
- /**
- * Returns set of IP addresses for the port, include the IP addresses and subnet
- * identity.
- *
- * @return FixedIps Set of fixedIp
- */
- Set fixedIps();
-
- /**
- * Returns the basePort bindinghostId.
- *
- * @return basePort bindinghostId
- */
- BindingHostId bindingHostId();
-
- /**
- * Returns the basePort bindingVnicType.
- *
- * @return basePort bindingVnicType
- */
- String bindingVnicType();
-
- /**
- * Returns the basePort bindingVifType.
- *
- * @return basePort bindingVifType
- */
- String bindingVifType();
-
- /**
- * Returns the basePort bindingvifDetail.
- *
- * @return basePort bindingvifDetail
- */
- String bindingVifDetails();
-
- /**
- * Returns the security groups.
- *
- * @return port security groups
- */
- Iterable securityGroups();
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePortId.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePortId.java
deleted file mode 100644
index 4eb120a2cc..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/BasePortId.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onlab.util.Identifier;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a base port identifier.
- */
-public final class BasePortId extends Identifier {
- // Public construction is prohibited
- private BasePortId(String basePortId) {
- super(checkNotNull(basePortId, "BasePortId cannot be null"));
- }
-
- public String portId() {
- return identifier;
- }
-
- /**
- * Creates a virtualPort id using the supplied portId.
- *
- * @param portId baseport identifier
- * @return BasePortId
- */
- public static BasePortId portId(String portId) {
- return new BasePortId(portId);
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultBasePort.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultBasePort.java
deleted file mode 100644
index ec9e59ec5f..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultBasePort.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Default implementation of Base port.
- */
-public final class DefaultBasePort implements BasePort {
- private final BasePortId id;
- private final TenantNetworkId networkId;
- private final Boolean adminStateUp;
- private final String name;
- private final String state;
- private final MacAddress macAddress;
- private final TenantId tenantId;
- private final String deviceOwner;
- private final DeviceId deviceId;
- private final Set fixedIps;
- private final BindingHostId bindingHostId;
- private final String bindingVnicType;
- private final String bindingVifType;
- private final String bindingVifDetails;
- private final Set allowedAddressPairs;
- private final Set securityGroups;
-
- /**
- * Creates a BasePort object.
- *
- * @param id the base port identifier
- * @param networkId the network identifier
- * @param adminStateUp adminStateup true or false
- * @param strMap the map of properties of base port
- * @param state base port state
- * @param macAddress the MAC address
- * @param tenantId the tenant identifier
- * @param deviceId the device identifier
- * @param fixedIps set of fixed IP
- * @param bindingHostId the binding host identifier
- * @param allowedAddressPairs the collection of allowdeAddressPairs
- * @param securityGroups the collection of securityGroups
- */
- public DefaultBasePort(BasePortId id,
- TenantNetworkId networkId,
- Boolean adminStateUp,
- Map strMap,
- String state,
- MacAddress macAddress,
- TenantId tenantId,
- DeviceId deviceId,
- Set fixedIps,
- BindingHostId bindingHostId,
- Set allowedAddressPairs,
- Set securityGroups) {
- this.id = id;
- this.networkId = networkId;
- this.adminStateUp = adminStateUp;
- this.name = strMap.get("name");
- this.state = state;
- this.macAddress = macAddress;
- this.tenantId = tenantId;
- this.deviceOwner = strMap.get("deviceOwner");
- this.deviceId = deviceId;
- this.fixedIps = fixedIps;
- this.bindingHostId = bindingHostId;
- this.bindingVnicType = strMap.get("bindingVnicType");
- this.bindingVifType = strMap.get("bindingVifType");
- this.bindingVifDetails = strMap.get("bindingVifDetails");
- this.allowedAddressPairs = allowedAddressPairs;
- this.securityGroups = securityGroups;
- }
-
- @Override
- public BasePortId portId() {
- return id;
- }
-
- @Override
- public TenantNetworkId networkId() {
- return networkId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public boolean adminStateUp() {
- return adminStateUp;
- }
-
- @Override
- public String state() {
- return state;
- }
-
- @Override
- public MacAddress macAddress() {
- return macAddress;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public DeviceId deviceId() {
- return deviceId;
- }
-
- @Override
- public String deviceOwner() {
- return deviceOwner;
- }
-
- @Override
- public Collection allowedAddressPairs() {
- return allowedAddressPairs;
- }
-
- @Override
- public Set fixedIps() {
- return fixedIps;
- }
-
- @Override
- public BindingHostId bindingHostId() {
- return bindingHostId;
- }
-
- @Override
- public String bindingVnicType() {
- return bindingVifType;
- }
-
- @Override
- public String bindingVifType() {
- return bindingVifType;
- }
-
- @Override
- public String bindingVifDetails() {
- return bindingVifDetails;
- }
-
- @Override
- public Collection securityGroups() {
- return securityGroups;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, networkId, adminStateUp, name, state,
- macAddress, tenantId, deviceId, deviceOwner,
- allowedAddressPairs, fixedIps, bindingHostId,
- bindingVnicType, bindingVifType, bindingVifDetails,
- securityGroups);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultBasePort) {
- final DefaultBasePort that = (DefaultBasePort) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.networkId, that.networkId)
- && Objects.equals(this.adminStateUp, that.adminStateUp)
- && Objects.equals(this.state, that.state)
- && Objects.equals(this.name, that.name)
- && Objects.equals(this.tenantId, that.tenantId)
- && Objects.equals(this.macAddress, that.macAddress)
- && Objects.equals(this.deviceId, that.deviceId)
- && Objects.equals(this.deviceOwner, that.deviceOwner)
- && Objects.equals(this.allowedAddressPairs,
- that.allowedAddressPairs)
- && Objects.equals(this.fixedIps, that.fixedIps)
- && Objects.equals(this.bindingHostId, that.bindingHostId)
- && Objects.equals(this.bindingVifDetails,
- that.bindingVifDetails)
- && Objects.equals(this.bindingVifType, that.bindingVifType)
- && Objects.equals(this.bindingVnicType,
- that.bindingVnicType)
- && Objects.equals(this.securityGroups, that.securityGroups);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("network_id", networkId)
- .add("adminStateUp", adminStateUp).add("state", state)
- .add("name", name).add("state", state)
- .add("macAddress", macAddress).add("tenantId", tenantId)
- .add("deviced", deviceId).add("deviceOwner", deviceOwner)
- .add("allowedAddressPairs", allowedAddressPairs)
- .add("fixedIp", fixedIps).add("bindingHostId", bindingHostId)
- .add("bindingVnicType", bindingVnicType)
- .add("bindingVifDetails", bindingVifDetails)
- .add("bindingVifType", bindingVifType)
- .add("securityGroups", securityGroups).toString();
- }
-
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnAfConfig.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnAfConfig.java
deleted file mode 100644
index afa32a0cac..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnAfConfig.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RT_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RT_TYPE_CANNOT_BE_NULL;
-
-/**
- * Default implementation of VPN AF configuration.
- */
-public class DefaultVpnAfConfig implements VpnAfConfig {
-
- private final String exportRoutePolicy;
- private final String importRoutePolicy;
- private final VpnRouteTarget routeTarget;
- private final String routeTargetType;
-
- /**
- * creates vpn af configuration object.
- *
- * @param exportRoutePolicy export route policy
- * @param importRoutePolicy import route policy
- * @param routeTarget route target value
- * @param routeTargetType route target type
- */
- public DefaultVpnAfConfig(String exportRoutePolicy,
- String importRoutePolicy,
- VpnRouteTarget routeTarget,
- String routeTargetType) {
- this.exportRoutePolicy = checkNotNull(exportRoutePolicy,
- ID_CANNOT_BE_NULL);
- this.importRoutePolicy = checkNotNull(importRoutePolicy,
- ID_CANNOT_BE_NULL);
- this.routeTarget = checkNotNull(routeTarget, RT_CANNOT_BE_NULL);
- this.routeTargetType = checkNotNull(routeTargetType,
- RT_TYPE_CANNOT_BE_NULL);
- }
-
- @Override
- public String exportRoutePolicy() {
- return exportRoutePolicy;
- }
-
- @Override
- public String importRoutePolicy() {
- return importRoutePolicy;
- }
-
- @Override
- public VpnRouteTarget routeTarget() {
- return routeTarget;
- }
-
- @Override
- public String routeTargetType() {
- return routeTargetType;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("exportRoutePolicy", exportRoutePolicy)
- .add("importRoutePolicy", importRoutePolicy)
- .add("routeTarget", routeTarget)
- .add("routeTargetType", routeTargetType)
- .toString();
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnInstance.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnInstance.java
deleted file mode 100644
index 62b1a70bf2..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnInstance.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onosproject.evpnrouteservice.EvpnInstanceName;
-import org.onosproject.evpnrouteservice.RouteDistinguisher;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.CONFIG_RT_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DESCRIPTION;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DESCRIPTION_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EXPORT_RT_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IMPORT_RT_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INSTANCE_NAME_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RD_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_DISTINGUISHER;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPNINSTANCE_NAME;
-
-/**
- * Default implementation of VPN instance.
- */
-public class DefaultVpnInstance implements VpnInstance {
- private final VpnInstanceId id;
- private final String description;
- private final EvpnInstanceName name;
- private final RouteDistinguisher routeDistinguisher;
- private final Set exportRtSet;
- private final Set importRtSet;
- private final Set configRtSet;
-
-
- /**
- * creates vpn instance object.
- *
- * @param id vpn instance identifier
- * @param instanceName the name of vpn instance
- * @param description the description of vpn instance
- * @param routeDistinguisher the routeDistinguisher of vpn instance
- * @param exportRtSet the export route target information
- * @param importRtSet the import route target information
- * @param configRtSet the config route target information
- */
- public DefaultVpnInstance(VpnInstanceId id, EvpnInstanceName instanceName,
- String description,
- RouteDistinguisher routeDistinguisher,
- Set exportRtSet,
- Set importRtSet,
- Set configRtSet) {
- this.id = checkNotNull(id, ID_CANNOT_BE_NULL);
- this.name = checkNotNull(instanceName, INSTANCE_NAME_CANNOT_BE_NULL);
- this.description = checkNotNull(description,
- DESCRIPTION_CANNOT_BE_NULL);
- this.routeDistinguisher = checkNotNull(routeDistinguisher,
- RD_CANNOT_BE_NULL);
- this.exportRtSet = checkNotNull(exportRtSet, EXPORT_RT_CANNOT_BE_NULL);
- this.importRtSet = checkNotNull(importRtSet, IMPORT_RT_CANNOT_BE_NULL);
- this.configRtSet = checkNotNull(configRtSet, CONFIG_RT_CANNOT_BE_NULL);
- }
-
- @Override
- public VpnInstanceId id() {
- return id;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public RouteDistinguisher routeDistinguisher() {
- return routeDistinguisher;
- }
-
- @Override
- public EvpnInstanceName vpnInstanceName() {
- return name;
- }
-
- @Override
- public Set getExportRouteTargets() {
- return exportRtSet;
- }
-
- @Override
- public Set getImportRouteTargets() {
- return importRtSet;
- }
-
- @Override
- public Set getConfigRouteTargets() {
- return configRtSet;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, name, description, routeDistinguisher,
- exportRtSet, importRtSet, configRtSet);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultVpnInstance) {
- final DefaultVpnInstance that = (DefaultVpnInstance) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.name, that.name)
- && Objects.equals(this.description, that.description)
- && Objects.equals(this.routeDistinguisher,
- that.routeDistinguisher)
- && Objects.equals(this.exportRtSet, that.exportRtSet)
- && Objects.equals(this.importRtSet, that.importRtSet)
- && Objects.equals(this.configRtSet, that.configRtSet);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add(ID, id)
- .add(DESCRIPTION, description)
- .add(VPNINSTANCE_NAME, name)
- .add(ROUTE_DISTINGUISHER, routeDistinguisher)
- .add("exportRtSet", exportRtSet)
- .add("importRtSet", importRtSet)
- .add("configRtSet", configRtSet)
- .toString();
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnPort.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnPort.java
deleted file mode 100644
index c036a5f36b..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/DefaultVpnPort.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID_CANNOT_BE_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_ID_CANNOT_BE_NULL;
-
-/**
- * Default implementation of VPN port.
- */
-public class DefaultVpnPort implements VpnPort {
-
- private final VpnPortId id;
- private final VpnInstanceId vpnInstanceId;
-
- /**
- * creates vpn port object.
- *
- * @param id vpn port id
- * @param vpnInstanceId vpn instance id
- */
- public DefaultVpnPort(VpnPortId id, VpnInstanceId vpnInstanceId) {
- this.id = checkNotNull(id, ID_CANNOT_BE_NULL);
- this.vpnInstanceId = checkNotNull(vpnInstanceId,
- VPN_INSTANCE_ID_CANNOT_BE_NULL);
- }
-
- @Override
- public VpnPortId id() {
- return id;
- }
-
- @Override
- public VpnInstanceId vpnInstanceId() {
- return vpnInstanceId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, vpnInstanceId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultVpnPort) {
- final DefaultVpnPort that = (DefaultVpnPort) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.vpnInstanceId, that.vpnInstanceId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add(ID, id)
- .add(VPN_INSTANCE_ID, vpnInstanceId).toString();
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/EvpnConstants.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/EvpnConstants.java
deleted file mode 100644
index 3bb692ca50..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/EvpnConstants.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-/**
- * Provides constants used in EVPN openflow application.
- */
-public final class EvpnConstants {
- private EvpnConstants() {
- }
-
- public static final String APP_ID = "org.onosproject.evpnopenflow";
- public static final String EVPN_OPENFLOW_START = "evpn-openflow app is " +
- "started";
- public static final String EVPN_OPENFLOW_STOP = "evpn-openflow app is " +
- "stopped";
- public static final String EVPN_VPN_PORT_START = "EVPN port started";
- public static final String EVPN_VPN_PORT_STOP = "EVPN port stopped";
- public static final String EVPN_VPN_INSTANCE_START = "EVPN instance " +
- "started";
- public static final String EVPN_VPN_INSTANCE_STOP = "EVPN instance " +
- "stopped";
- public static final String HOST_DETECT = "Host detected {}";
- public static final String HOST_VANISHED = "Host vanished {}";
- public static final String IFACEID = "ifaceid";
- public static final String IFACEID_OF_HOST_IS_NULL =
- "The ifaceId of host is null";
- public static final String CANT_FIND_VPN_PORT = "Can't find vpnport {}";
- public static final String CANT_FIND_VPN_INSTANCE = "EVPN instance {} is " +
- "not exist";
- public static final String CANT_FIND_CONTROLLER_DEVICE = "Can't find " +
- "controller of device: {}";
- public static final String GET_PRIVATE_LABEL = "Get private label {}";
- public static final String RELEASE_LABEL_FAILED = "Release resoure label " +
- "{} failed";
- public static final String VPN_PORT_UNBIND = "On EVPN port unbind";
- public static final String VPN_PORT_BIND = "On EVPN port bind";
- public static final String SLASH = "/";
- public static final String COMMA = ",";
- public static final String VPN_INSTANCE_TARGET = "VpnService";
- public static final String VPN_PORT_TARGET = "VpnBinding";
- public static final String BASEPORT = "Port";
- public static final String VPN_AF_TARGET = "VpnAfConfig";
- public static final String BGP_PEERING = "BGPPeering";
- public static final String DATA_PLANE_TUNNEL = "DataplaneTunnel";
- public static final String VPN_PORT_STORE = "evpn-port-store";
- public static final String BASE_PORT_STORE = "evpn-baseport-store";
- public static final String VPN_INSTANCE_STORE =
- "evpn-instance-store";
- public static final String VPN_PORT_ID_NOT_NULL = "EVPN port ID cannot be" +
- " null";
- public static final String VPN_PORT_NOT_NULL = "EVPN port cannot be null";
- public static final String RESPONSE_NOT_NULL = "JsonNode can not be null";
- public static final String LISTENER_NOT_NULL = "Listener cannot be null";
- public static final String EVENT_NOT_NULL = "Event cannot be null";
- public static final String DELETE = "delete";
- public static final String SET = "set";
- public static final String UPDATE = "update";
- public static final String VPN_PORT_ID = "EVPN port ID is {} ";
- public static final String VPN_PORT_CREATION_FAILED = "The EVPN port " +
- "creation is failed whose identifier is {} ";
- public static final String VPN_PORT_IS_NOT_EXIST = "The EVPN port is not " +
- "exist whose identifier is {}";
- public static final String VPN_PORT_UPDATE_FAILED = "The EVPN port update" +
- " is failed whose identifier is {}";
- public static final String VPN_PORT_DELETE_FAILED =
- "The EVPN port delete is failed whose identifier is {}";
- public static final String INTERFACE_ID = "interface_id";
- public static final String ID = "id";
- public static final String VPN_INSTANCE = "service_id";
- public static final String VPN_INSTANCE_ID_NOT_NULL = "EVPN instance ID " +
- "cannot be null";
- public static final String VPN_INSTANCE_NOT_NULL = "EVPN instance cannot " +
- "be null";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
- public static final String INSTANCE_ID = "EVPN instance ID is {} ";
- public static final String VPN_INSTANCE_CREATION_FAILED = "The " +
- "EVPN instance creation is failed whose identifier is {} ";
- public static final String VPN_INSTANCE_IS_NOT_EXIST = "The EVPN instance" +
- " is not exist whose identifier is {}";
- public static final String VPN_INSTANCE_UPDATE_FAILED = "The EVPN " +
- "instance update is failed whose identifier is {}";
- public static final String VPN_INSTANCE_DELETE_FAILED = "The EVPN " +
- "instance delete is failed whose identifier is {}";
- public static final String VPN_INSTANCE_NAME = "name";
- public static final String DESCRIPTION = "description";
- public static final String ROUTE_DISTINGUISHERS = "route_distinguishers";
- public static final String IPV4_FAMILY = "ipv4_family";
- static final String ID_CANNOT_BE_NULL = "ID cannot be null";
- static final String INSTANCE_NAME_CANNOT_BE_NULL = "Instance name cannot " +
- "be null";
- static final String DESCRIPTION_CANNOT_BE_NULL = "Description cannot be " +
- "null";
- static final String RD_CANNOT_BE_NULL = "RouteDistinguisher cannot be null";
- static final String RT_CANNOT_BE_NULL = "RouteTarget cannot be null";
- static final String VPNINSTANCE_NAME = "vpnInstanceName";
- static final String ROUTE_DISTINGUISHER = "routeDistinguisher";
- static final String VPN_INSTANCE_ID_CANNOT_BE_NULL = "EVPN instance ID " +
- "cannot be null";
- static final String VPN_INSTANCE_ID = "vpnInstanceId";
- public static final String FORMAT_VPN_INSTANCE = "Id=%s, description=%s,"
- + " name=%s, routeDistinguisher=%s, routeTarget=%s";
- public static final String FORMAT_VPN_PORT = " EVPN port id=%-32s, " +
- "EVPN instance id=%-18s";
- public static final String FORMAT_PRIVATE_ROUTE = " %-18s %-15s %-10s";
- public static final String FORMAT_PUBLIC_ROUTE = " %-18s %-18s %-10s";
- public static final String SWITCH_CHANNEL_ID = "channelId";
- public static final String NOT_MASTER_FOR_SPECIFIC_DEVICE = "The local " +
- "controller is not master for the specified deviceId";
- public static final String VPN_AF_CONFIG_STORE =
- "evpn-vpn-af-config-store";
- public static final String EVPN_VPN_AF_CONFIG_START = "EVPN af config" +
- " started";
- public static final String EVPN_VPN_AF_CONFIG_STOP = "EVPN af config" +
- " stopped";
- static final String RT_TYPE_CANNOT_BE_NULL = "Route target type " +
- "cannot be null";
- public static final String VPN_AF_CONFIG_NOT_NULL = "EVPN af config be " +
- "null";
- public static final String ROUTE_TARGET_VALUE = "Route target value is {} ";
- public static final String VPN_AF_CONFIG_CREATION_FAILED = "The " +
- "EVPN af config creation is failed whose route target is {} ";
- public static final String VPN_AF_CONFIG_UPDATE_FAILED = "The EVPN af " +
- "config update is failed whose identifier is {}";
- public static final String VPN_AF_CONFIG_IS_NOT_EXIST = "The EVPN AF " +
- "config is not exist whose identifier is {}";
- public static final String ROUTE_TARGET_CANNOT_NOT_NULL = "Route target " +
- "value cannot be null";
- public static final String ROUTE_TARGET_DELETE_FAILED = "The route target" +
- " delete is failed whose route target value is {}";
- static final String EXPORT_RT_CANNOT_BE_NULL = "export route " +
- "target set cannot be null";
- static final String IMPORT_RT_CANNOT_BE_NULL = "import route " +
- "target set cannot be null";
- static final String CONFIG_RT_CANNOT_BE_NULL = "import route " +
- "target set cannot be null";
- public static final String EXPORT_EXTCOMMUNITY = "export_extcommunity";
- public static final String IMPORT_EXTCOMMUNITY = "import_extcommunity";
- public static final String BOTH = "both";
- public static final String INVALID_ROUTE_TARGET_TYPE
- = "Invalid route target type has received";
- public static final String INVALID_EVENT_RECEIVED
- = "Invalid event is received while processing network " +
- "configuration event";
- public static final String NETWORK_CONFIG_EVENT_IS_RECEIVED
- = "Event is received from network configuration {}";
- public static final int ARP_PRIORITY = 0xffff;
- public static final short ARP_RESPONSE = 0x2;
- public static final String INVALID_TARGET_RECEIVED
- = "Invalid target type has received";
- public static final String INVALID_ACTION_VPN_AF_CONFIG
- = "Invalid action is received while processing VPN af" +
- " configuration";
- public static final String EXPORT_ROUTE_POLICY = "export_route_policy";
- public static final String IMPORT_ROUTE_POLICY = "import_route_policy";
- public static final String VRF_RT_TYPE = "vrf_rt_type";
- public static final String VRF_RT_VALUE = "vrf_rt_value";
- public static final String BGP_EVPN_ROUTE_UPDATE_START
- = "bgp evpn route update start {}";
- public static final String MPLS_OUT_FLOWS = "mpls out flows --> {}";
- public static final String BGP_EVPN_ROUTE_DELETE_START
- = "bgp route delete start {}";
- public static final String ROUTE_ADD_ARP_RULES = "Route ARP Rules-->ADD";
- public static final String ROUTE_REMOVE_ARP_RULES
- = "Route ARP Rules-->REMOVE";
- public static final String TUNNEL_DST = "tunnelDst";
- public static final String FAILED_TO_SET_TUNNEL_DST
- = "Failed to get extension instruction to set tunnel dst {}";
- public static final String VXLAN = "vxlan";
- public static final String CANNOT_FIND_TUNNEL_PORT_DEVICE =
- "Can't find tunnel port in device {}";
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnAfConfig.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnAfConfig.java
deleted file mode 100644
index 83d5686326..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnAfConfig.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-/**
- * Representation of a VPN af configuration.
- */
-public interface VpnAfConfig {
-
- /**
- * Returns the export route policy information.
- *
- * @return export route policy
- */
- String exportRoutePolicy();
-
- /**
- * Returns the import route policy information.
- *
- * @return export route policy
- */
- String importRoutePolicy();
-
- /**
- * Returns the route target value.
- *
- * @return route target value
- */
- VpnRouteTarget routeTarget();
-
- /**
- * Returns the route target type.
- *
- * @return route target type
- */
- String routeTargetType();
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstance.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstance.java
deleted file mode 100644
index 3c2d062bcc..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstance.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onosproject.evpnrouteservice.EvpnInstanceName;
-import org.onosproject.evpnrouteservice.RouteDistinguisher;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-import java.util.Set;
-
-/**
- * Representation of a VPN instance.
- */
-public interface VpnInstance {
-
- /**
- * Returns the VPN instance identifier.
- *
- * @return VPN instance identifier
- */
- VpnInstanceId id();
-
- /**
- * Returns the VPN instance description.
- *
- * @return VPN instance description
- */
- String description();
-
- /**
- * Returns the VPN instance route distinguishes.
- *
- * @return VPN instance route distinguishes
- */
- RouteDistinguisher routeDistinguisher();
-
- /**
- * Returns the VPN instance name.
- *
- * @return VPN instance name
- */
- EvpnInstanceName vpnInstanceName();
-
- /**
- * Returns the export route target information.
- *
- * @return export route target information
- */
- Set getExportRouteTargets();
-
- /**
- * Returns the import route target information.
- *
- * @return VPN instance ipv4 family
- */
- Set getImportRouteTargets();
-
- /**
- * Returns the config route target information.
- *
- * @return config route target information.
- */
- Set getConfigRouteTargets();
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstanceId.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstanceId.java
deleted file mode 100644
index 03399ed7bf..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnInstanceId.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onlab.util.Identifier;
-
-/**
- * Immutable representation of a VPN instance identity.
- */
-public final class VpnInstanceId extends Identifier {
- // Public construction is prohibited
- private VpnInstanceId(String vpnInstanceId) {
- super(vpnInstanceId);
- }
-
- /**
- * Creates a VPN instance identifier.
- *
- * @param vpnInstanceId VPN instance identify string
- * @return VPN instance identifier
- */
- public static VpnInstanceId vpnInstanceId(String vpnInstanceId) {
- return new VpnInstanceId(vpnInstanceId);
- }
-
- /**
- * Returns VPN instance identifier.
- *
- * @return the VPN instance identifier
- */
- public String vpnInstanceId() {
- return identifier;
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPort.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPort.java
deleted file mode 100644
index 82f5336fe5..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPort.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-/**
- * Representation of a VPN port.
- */
-public interface VpnPort {
-
- /**
- * Returns the VPN port identifier.
- *
- * @return VPN port identifier
- */
- VpnPortId id();
-
- /**
- * Returns the VPN instance identifier.
- *
- * @return VPN instance identifier
- */
- VpnInstanceId vpnInstanceId();
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPortId.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPortId.java
deleted file mode 100644
index f900830643..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/VpnPortId.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc;
-
-import org.onlab.util.Identifier;
-
-/**
- * Immutable representation of a VPN port identity.
- */
-public final class VpnPortId extends Identifier {
- // Public construction is prohibited
- private VpnPortId(String vpnPortId) {
- super(vpnPortId);
- }
-
- /**
- * Creates a VPN port identifier.
- *
- * @param vpnPortId VPN port identifier
- * @return VPN port identifier
- */
- public static VpnPortId vpnPortId(String vpnPortId) {
- return new VpnPortId(vpnPortId);
- }
-
- /**
- * Returns VPN port identifier.
- *
- * @return the VPN port identifier
- */
- public String vpnPortId() {
- return identifier;
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortEvent.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortEvent.java
deleted file mode 100644
index acb762aa25..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortEvent.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.baseport;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.evpnopenflow.rsc.BasePort;
-
-/**
- * Describes base port event.
- */
-public class BasePortEvent extends AbstractEvent {
- /**
- * Type of base port events.
- */
- public enum Type {
- /**
- * Signifies that base port has been created.
- */
- BASE_PORT_PUT,
- /**
- * Signifies that base port has been deleted.
- */
- BASE_PORT_DELETE,
- /**
- * Signifies that base port has been updated.
- */
- BASE_PORT_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified base port.
- *
- * @param type base port event type
- * @param basePort base port subject
- */
- public BasePortEvent(Type type, BasePort basePort) {
- super(type, basePort);
- }
-
- /**
- * Creates an event of a given type and for the specified base port.
- *
- * @param type base port event type
- * @param basePort base port subject
- * @param time occurrence time
- */
- public BasePortEvent(Type type, BasePort basePort, long time) {
- super(type, basePort, time);
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortListener.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortListener.java
deleted file mode 100644
index 2822bb36fd..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.baseport;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of base port related events.
- */
-public interface BasePortListener extends EventListener {
-
-}
\ No newline at end of file
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortService.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortService.java
deleted file mode 100644
index c3bdb2b74f..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/BasePortService.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.baseport;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.evpnopenflow.rsc.BasePort;
-import org.onosproject.evpnopenflow.rsc.BasePortId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-
-import java.util.Collection;
-
-
-/**
- * Service for interacting with the inventory of basePort.
- */
-public interface BasePortService {
- /**
- * Returns if the basePort is existed.
- *
- * @param basePortId basePort identifier
- * @return true or false if one with the given identifier is not existed.
- */
- boolean exists(BasePortId basePortId);
-
- /**
- * Returns the basePort with the identifier.
- *
- * @param basePortId basePort ID
- * @return BasePort or null if one with the given ID is not know.
- */
- BasePort getPort(BasePortId basePortId);
-
- /**
- * Returns the basePort associated with the fixedIP.
- *
- * @param fixedIP the fixedIP identifier
- * @return basePort.
- */
- BasePort getPort(FixedIp fixedIP);
-
- /**
- * Returns the basePort associated with the mac address.
- *
- * @param mac the mac address
- * @return basePort.
- */
- BasePort getPort(MacAddress mac);
-
- /**
- * Returns the basePort associated with the networkId and ip.
- *
- * @param networkId the TenantNetworkId identifier
- * @param ip the ip identifier
- * @return basePort.
- */
- BasePort getPort(TenantNetworkId networkId, IpAddress ip);
-
- /**
- * Returns the collection of the currently known basePort.
- *
- * @return collection of BasePort.
- */
- Collection getPorts();
-
- /**
- * Returns the collection of the basePorts associated with the networkId.
- *
- * @param networkId the network identifer
- * @return collection of basePort.
- */
- Collection getPorts(TenantNetworkId networkId);
-
- /**
- * Returns the collection of the basePorts associated with the tenantId.
- *
- * @param tenantId the tenant identifier
- * @return collection of basePorts.
- */
- Collection getPorts(TenantId tenantId);
-
- /**
- * Returns the collection of the basePorts associated with the deviceId.
- *
- * @param deviceId the device identifier
- * @return collection of basePort.
- */
- Collection getPorts(DeviceId deviceId);
-
- /**
- * Creates basePorts by basePorts.
- *
- * @param basePorts the iterable collection of basePorts
- * @return true if all given identifiers created successfully.
- */
- boolean createPorts(Iterable basePorts);
-
- /**
- * Updates basePorts by basePorts.
- *
- * @param basePorts the iterable collection of basePorts
- * @return true if all given identifiers updated successfully.
- */
- boolean updatePorts(Iterable basePorts);
-
- /**
- * Deletes basePortIds by basePortIds.
- *
- * @param basePortIds the iterable collection of basePort identifiers
- * @return true or false if one with the given identifier to delete is
- * successfully.
- */
- boolean removePorts(Iterable basePortIds);
-
- /**
- * process gluon config for vpn port information.
- *
- * @param action can be either update or delete
- * @param key can contain the id and also target information
- * @param value content of the vpn port configuration
- */
- void processGluonConfig(String action, String key, JsonNode value);
-
- /**
- * Adds the specified listener to Vpn Port manager.
- *
- * @param listener Vpn Port listener
- */
- void addListener(BasePortListener listener);
-
- /**
- * Removes the specified listener to Vpn Port manager.
- *
- * @param listener Vpn Port listener
- */
- void removeListener(BasePortListener listener);
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/BasePortManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/BasePortManager.java
deleted file mode 100644
index 27f9fd7ae1..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/BasePortManager.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.baseport.impl;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.evpnopenflow.rsc.BasePort;
-import org.onosproject.evpnopenflow.rsc.BasePortId;
-import org.onosproject.evpnopenflow.rsc.DefaultBasePort;
-import org.onosproject.evpnopenflow.rsc.baseport.BasePortEvent;
-import org.onosproject.evpnopenflow.rsc.baseport.BasePortListener;
-import org.onosproject.evpnopenflow.rsc.baseport.BasePortService;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.MultiValuedTimestamp;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.TenantRouter;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.APP_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.BASE_PORT_STORE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.LISTENER_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RESPONSE_NOT_NULL;
-
-/**
- * Provides implementation of the BasePort APIs.
- */
-@Component(immediate = true, service = BasePortService.class)
-public class BasePortManager implements BasePortService {
-
- private final Set listeners = Sets
- .newCopyOnWriteArraySet();
- private final Logger log = LoggerFactory.getLogger(getClass());
- private static final String BASEPORT_ID_NULL = "BasePort ID cannot be " +
- "null";
- private static final String BASEPORT_NOT_NULL = "BasePort cannot be " +
- "null";
- private static final String TENANTID_NOT_NULL = "TenantId cannot be null";
- private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null";
- private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null";
- private static final String FIXEDIP_NOT_NULL = "FixedIp cannot be null";
- private static final String MAC_NOT_NULL = "Mac address cannot be null";
- private static final String IP_NOT_NULL = "Ip cannot be null";
- private static final String EVENT_NOT_NULL = "event cannot be null";
- private static final String SET = "set";
- private static final String UPDATE = "update";
- private static final String DELETE = "delete";
- private static final String SLASH = "/";
- private static final String PROTON_BASE_PORT = "Port";
- private static final String JSON_NOT_NULL = "JsonNode can not be null";
-
- protected EventuallyConsistentMap vPortStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected CoreService coreService;
-
- @Activate
- public void activate() {
-
- appId = coreService.registerApplication(APP_ID);
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(MultiValuedTimestamp.class)
- .register(TenantNetworkId.class)
- .register(Host.class)
- .register(TenantNetwork.class)
- .register(TenantNetworkId.class)
- .register(TenantId.class)
- .register(SubnetId.class)
- .register(BasePortId.class)
- .register(BasePort.State.class)
- .register(AllowedAddressPair.class)
- .register(FixedIp.class)
- .register(FloatingIp.class)
- .register(FloatingIpId.class)
- .register(FloatingIp.Status.class)
- .register(UUID.class)
- .register(DefaultFloatingIp.class)
- .register(BindingHostId.class)
- .register(SecurityGroup.class)
- .register(IpAddress.class)
- .register(DefaultBasePort.class)
- .register(RouterId.class)
- .register(TenantRouter.class)
- .register(BasePort.class);
- vPortStore = storageService
- .eventuallyConsistentMapBuilder()
- .withName(BASE_PORT_STORE).withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp())
- .build();
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- vPortStore.destroy();
- log.info("Stoppped");
- }
-
- @Override
- public boolean exists(BasePortId vPortId) {
- checkNotNull(vPortId, BASEPORT_ID_NULL);
- return vPortStore.containsKey(vPortId);
- }
-
- @Override
- public BasePort getPort(BasePortId vPortId) {
- checkNotNull(vPortId, BASEPORT_ID_NULL);
- return vPortStore.get(vPortId);
- }
-
- @Override
- public BasePort getPort(FixedIp fixedIP) {
- checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
- List vPorts = new ArrayList<>();
- vPortStore.values().forEach(p -> {
- for (FixedIp fixedIp : p.fixedIps()) {
- if (fixedIp.equals(fixedIP)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
-
- @Override
- public BasePort getPort(MacAddress mac) {
- checkNotNull(mac, MAC_NOT_NULL);
- List vPorts = new ArrayList<>();
- vPortStore.values().forEach(p -> {
- if (p.macAddress().equals(mac)) {
- vPorts.add(p);
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
-
- @Override
- public BasePort getPort(TenantNetworkId networkId, IpAddress ip) {
- checkNotNull(networkId, NETWORKID_NOT_NULL);
- checkNotNull(ip, IP_NOT_NULL);
- List vPorts = new ArrayList<>();
- vPortStore.values().stream().filter(p -> p.networkId().equals(networkId))
- .forEach(p -> {
- for (FixedIp fixedIp : p.fixedIps()) {
- if (fixedIp.ip().equals(ip)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
-
- @Override
- public Collection getPorts() {
- return Collections.unmodifiableCollection(vPortStore.values());
- }
-
- @Override
- public Collection getPorts(TenantNetworkId networkId) {
- checkNotNull(networkId, NETWORKID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.networkId().equals(networkId))
- .collect(Collectors.toList());
- }
-
- @Override
- public Collection getPorts(TenantId tenantId) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.tenantId().equals(tenantId))
- .collect(Collectors.toList());
- }
-
- @Override
- public Collection getPorts(DeviceId deviceId) {
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.deviceId().equals(deviceId))
- .collect(Collectors.toList());
- }
-
- @Override
- public boolean createPorts(Iterable vPorts) {
- checkNotNull(vPorts, BASEPORT_NOT_NULL);
- for (BasePort vPort : vPorts) {
- log.info("vPortId is {} ", vPort.portId().toString());
- vPortStore.put(vPort.portId(), vPort);
- if (!vPortStore.containsKey(vPort.portId())) {
- log.info("The basePort is created failed whose identifier is" +
- " {} ",
- vPort.portId().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updatePorts(Iterable vPorts) {
- checkNotNull(vPorts, BASEPORT_NOT_NULL);
- for (BasePort vPort : vPorts) {
- vPortStore.put(vPort.portId(), vPort);
- if (!vPortStore.containsKey(vPort.portId())) {
- log.info("The basePort is not exist whose identifier is {}",
- vPort.portId().toString());
- return false;
- }
-
- vPortStore.put(vPort.portId(), vPort);
-
- if (!vPort.equals(vPortStore.get(vPort.portId()))) {
- log.info("The basePort is updated failed whose identifier " +
- "is {}",
- vPort.portId().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean removePorts(Iterable vPortIds) {
- checkNotNull(vPortIds, BASEPORT_ID_NULL);
- for (BasePortId vPortId : vPortIds) {
- vPortStore.remove(vPortId);
- if (vPortStore.containsKey(vPortId)) {
- log.info("The basePort is removed failed whose identifier is" +
- " {}",
- vPortId.toString());
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns a collection of basePorts from subnetNodes.
- *
- * @param vPortNodes the basePort json node
- * @return BasePort collection of vpn ports
- */
- private Collection changeJsonToSub(JsonNode vPortNodes) {
- checkNotNull(vPortNodes, JSON_NOT_NULL);
- Set fixedIps = null;
- TenantNetworkId tenantNetworkId = null;
- Map vportMap = new HashMap<>();
- Map strMap = new HashMap<>();
- BasePortId basePortId = BasePortId.portId(vPortNodes.get("id").asText());
- String name = vPortNodes.get("name").asText();
- TenantId tenantId = TenantId
- .tenantId(vPortNodes.get("tenant_id").asText());
- Boolean adminStateUp = vPortNodes.get("admin_state_up").asBoolean();
- String state = vPortNodes.get("status").asText();
- MacAddress macAddress = MacAddress
- .valueOf(vPortNodes.get("mac_address").asText());
- DeviceId deviceId = DeviceId
- .deviceId(vPortNodes.get("device_id").asText());
- String deviceOwner = vPortNodes.get("device_owner").asText();
- BindingHostId bindingHostId = BindingHostId
- .bindingHostId(vPortNodes.get("host_id").asText());
- String bindingVnicType = vPortNodes.get("vnic_type").asText();
- String bindingVifType = vPortNodes.get("vif_type").asText();
- String bindingVifDetails = vPortNodes.get("vif_details").asText();
- strMap.put("name", name);
- strMap.put("deviceOwner", deviceOwner);
- strMap.put("bindingVnicType", bindingVnicType);
- strMap.put("bindingVifType", bindingVifType);
- strMap.put("bindingVifDetails", bindingVifDetails);
- BasePort prevBasePort = getPort(basePortId);
- if (prevBasePort != null) {
- fixedIps = prevBasePort.fixedIps();
- tenantNetworkId = prevBasePort.networkId();
- }
- BasePort vPort = new DefaultBasePort(basePortId,
- tenantNetworkId,
- adminStateUp,
- strMap, state,
- macAddress, tenantId,
- deviceId, fixedIps,
- bindingHostId,
- null,
- null);
- vportMap.put(basePortId, vPort);
-
- return Collections.unmodifiableCollection(vportMap.values());
- }
-
- /**
- * Returns BasePort State.
- *
- * @param state the base port state
- * @return the basePort state
- */
- private BasePort.State isState(String state) {
- if (state.equals("ACTIVE")) {
- return BasePort.State.ACTIVE;
- } else {
- return BasePort.State.DOWN;
- }
-
- }
-
- /**
- * process Etcd response for port information.
- *
- * @param action can be either update or delete
- * @param key can contain the id and also target information
- * @param value content of the port configuration
- */
- @Override
- public void processGluonConfig(String action, String key, JsonNode value) {
- Collection basePorts;
- switch (action) {
- case DELETE:
- String[] list = key.split(SLASH);
- BasePortId basePortId
- = BasePortId.portId(list[list.length - 1]);
- Set basePortIds = Sets.newHashSet(basePortId);
- removePorts(basePortIds);
- break;
- case SET:
- checkNotNull(value, RESPONSE_NOT_NULL);
- basePorts = changeJsonToSub(value);
- createPorts(basePorts);
- break;
- case UPDATE:
- checkNotNull(value, RESPONSE_NOT_NULL);
- basePorts = changeJsonToSub(value);
- updatePorts(basePorts);
- break;
- default:
- log.info("Invalid action is received while processing VPN " +
- "port configuration");
- }
- }
-
- private void parseEtcdResponse(JsonNode jsonNode,
- String key,
- String action) {
- JsonNode modifyValue = null;
- if (action.equals(SET)) {
- modifyValue = jsonNode.get(key);
- }
- String[] list = key.split(SLASH);
- String target = list[list.length - 2];
- if (target.equals(PROTON_BASE_PORT)) {
- processGluonConfig(action, key, modifyValue);
- }
- }
-
- @Override
- public void addListener(BasePortListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(BasePortListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event vpn af config event
- */
- private void notifyListeners(BasePortEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- listeners.forEach(listener -> listener.event(event));
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/package-info.java
deleted file mode 100644
index 366dc00cbd..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * VPN resources that used by l3vpn.
- */
-package org.onosproject.evpnopenflow.rsc.baseport.impl;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/package-info.java
deleted file mode 100644
index 52f5d0c861..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/baseport/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * VPN resources that used by l3vpn.
- */
-package org.onosproject.evpnopenflow.rsc.baseport;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPrivateRouteListCommand.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPrivateRouteListCommand.java
deleted file mode 100644
index d069bc3671..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPrivateRouteListCommand.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.cli;
-
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.evpnopenflow.manager.EvpnService;
-import org.onosproject.evpnopenflow.manager.impl.EvpnManager;
-import org.onosproject.evpnrouteservice.EvpnInstanceRoute;
-
-import java.util.Collection;
-
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.FORMAT_PRIVATE_ROUTE;
-
-/**
- * Support for displaying EVPN private routes.
- */
-@Service
-@Command(scope = "onos", name = "evpn-private-routes", description = "Lists" +
- " all EVPN private routes")
-public class EvpnPrivateRouteListCommand extends AbstractShellCommand {
- private static final String FORMAT_HEADER =
- " VPN name Prefix Next Hop";
-
- @Override
- protected void doExecute() {
- EvpnService service = AbstractShellCommand.get(EvpnService.class);
- EvpnManager evpnManager = (EvpnManager) service;
- Collection evpnRoutes = evpnManager.evpnInstanceRoutes;
- if (evpnRoutes != null) {
- print(FORMAT_HEADER);
- evpnRoutes.forEach(evpnInstanceRoute -> {
- print(FORMAT_PRIVATE_ROUTE, evpnInstanceRoute.evpnInstanceName(),
- evpnInstanceRoute.prefix().address().getIp4Address(), evpnInstanceRoute
- .getNextHopl());
- });
- }
- }
-
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPublicRouteListCommand.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPublicRouteListCommand.java
deleted file mode 100644
index 809090de80..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/EvpnPublicRouteListCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.cli;
-
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.evpnrouteservice.EvpnRoute;
-import org.onosproject.evpnrouteservice.EvpnRouteSet;
-import org.onosproject.evpnrouteservice.EvpnRouteStore;
-
-import java.util.Collection;
-
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.FORMAT_PUBLIC_ROUTE;
-
-/**
- * Support for displaying EVPN public routes.
- */
-@Service
-@Command(scope = "onos", name = "evpn-public-routes", description = "Lists" +
- " all EVPN public routes")
-public class EvpnPublicRouteListCommand extends AbstractShellCommand {
- private static final String FORMAT_HEADER =
- " MAC Prefix Next Hop";
-
- @Override
- protected void doExecute() {
- EvpnRouteStore evpnRouteStore = AbstractShellCommand.get(EvpnRouteStore.class);
-
- evpnRouteStore.getRouteTables().forEach(routeTableId -> {
- Collection routes
- = evpnRouteStore.getRoutes(routeTableId);
- if (routes != null) {
- routes.forEach(route -> {
- Collection evpnRoutes = route.routes();
- print(FORMAT_HEADER);
- evpnRoutes.forEach(evpnRoute -> {
- print(FORMAT_PUBLIC_ROUTE, evpnRoute.prefixMac(),
- evpnRoute.prefixIp().address().getIp4Address(),
- evpnRoute.ipNextHop());
- });
- });
- }
- });
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnInstListCommand.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnInstListCommand.java
deleted file mode 100644
index 33074f7871..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnInstListCommand.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.cli;
-
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.evpnopenflow.rsc.EvpnConstants;
-import org.onosproject.evpnopenflow.rsc.VpnInstance;
-import org.onosproject.evpnopenflow.rsc.vpninstance.VpnInstanceService;
-
-import java.util.Collection;
-
-/**
- * Support for displaying EVPN VPN instances.
- */
-@Service
-@Command(scope = "onos", name = "evpn-instance-list", description = "Lists " +
- "all EVPN instances")
-public class VpnInstListCommand extends AbstractShellCommand {
-
- @Override
- protected void doExecute() {
- VpnInstanceService service = get(VpnInstanceService.class);
- Collection vpnInstances = service
- .getInstances();
- vpnInstances.forEach(vpnInstance -> {
- print(EvpnConstants.FORMAT_VPN_INSTANCE, vpnInstance.id(),
- vpnInstance.description(),
- vpnInstance.vpnInstanceName(),
- vpnInstance.routeDistinguisher(),
- vpnInstance.getExportRouteTargets(),
- vpnInstance.getImportRouteTargets());
- });
- }
-
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnPortListCommand.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnPortListCommand.java
deleted file mode 100644
index a4c7da8293..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/VpnPortListCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.cli;
-
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.evpnopenflow.rsc.VpnPort;
-import org.onosproject.evpnopenflow.rsc.vpnport.VpnPortService;
-
-import java.util.Collection;
-
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.FORMAT_VPN_PORT;
-
-/**
- * Support for displaying EVPN VPN ports.
- */
-@Service
-@Command(scope = "onos", name = "evpn-port-list", description = "Lists all" +
- "EVPN ports")
-public class VpnPortListCommand extends AbstractShellCommand {
-
- @Override
- protected void doExecute() {
- VpnPortService portService = get(VpnPortService.class);
- Collection ports = portService.getPorts();
- ports.forEach(port -> {
- print(FORMAT_VPN_PORT, port.id(), port.vpnInstanceId());
- });
- }
-
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/package-info.java
deleted file mode 100644
index 3bc47c8370..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/cli/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Implementation CLI for EVPN services.
- */
-package org.onosproject.evpnopenflow.rsc.cli;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/package-info.java
deleted file mode 100644
index c37dc81bd4..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * EVPN resource package.
- */
-package org.onosproject.evpnopenflow.rsc;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigEvent.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigEvent.java
deleted file mode 100644
index 944698c1e4..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigEvent.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpnafconfig;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.evpnopenflow.rsc.VpnAfConfig;
-
-/**
- * Describes network VPN af config event.
- */
-public class VpnAfConfigEvent extends AbstractEvent {
-
- /**
- * Type of VPN port events.
- */
- public enum Type {
- /**
- * Signifies that VPN af config has been set.
- */
- VPN_AF_CONFIG_SET,
- /**
- * Signifies that VPN af config has been deleted.
- */
- VPN_AF_CONFIG_DELETE,
- /**
- * Signifies that VPN af config has been updated.
- */
- VPN_AF_CONFIG_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified VPN af config.
- *
- * @param type VPN af config type
- * @param vpnAfConfig VPN af config subject
- */
- public VpnAfConfigEvent(Type type, VpnAfConfig vpnAfConfig) {
- super(type, vpnAfConfig);
- }
-
- /**
- * Creates an event of a given type and for the specified VPN af config.
- *
- * @param type VPN af config type
- * @param vpnAfConfig VPN af config subject
- * @param time occurrence time
- */
- public VpnAfConfigEvent(Type type, VpnAfConfig vpnAfConfig, long time) {
- super(type, vpnAfConfig, time);
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigListener.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigListener.java
deleted file mode 100644
index 42db841b91..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpnafconfig;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of VPN af config related events.
- */
-public interface VpnAfConfigListener extends EventListener {
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigService.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigService.java
deleted file mode 100644
index ecde40d862..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/VpnAfConfigService.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpnafconfig;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onosproject.evpnopenflow.rsc.VpnAfConfig;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-import java.util.Collection;
-
-/**
- * Service for interacting with the inventory of VPN af config instance.
- */
-public interface VpnAfConfigService {
- /**
- * Returns if the route target is existed.
- *
- * @param routeTarget route target
- * @return true or false if one with the given route target is not existed.
- */
- boolean exists(VpnRouteTarget routeTarget);
-
- /**
- * Returns the VPN af config with the route target.
- *
- * @param routeTarget route target
- * @return VPN af config or null if one with the given route target is not
- * know.
- */
- VpnAfConfig getVpnAfConfig(VpnRouteTarget routeTarget);
-
- /**
- * Returns the collection of the currently known VPN af configurations.
- *
- * @return collection of VPN af configurations.
- */
- Collection getVpnAfConfigs();
-
- /**
- * Creates VPN af configurations by vpnAfConfigs.
- *
- * @param vpnAfConfigs the iterable collection of vpnAfConfigs
- * @return true if all given VPN af configs created successfully
- */
- boolean createVpnAfConfigs(Iterable vpnAfConfigs);
-
- /**
- * Updates VPN af configurations by vpnAfConfigs.
- *
- * @param vpnAfConfigs the iterable collection of vpnAfConfigs
- * @return true if all given VPN af configs created successfully.
- */
- boolean updateVpnAfConfigs(Iterable vpnAfConfigs);
-
- /**
- * Deletes vpnAfConfigs by route target.
- *
- * @param routeTarget the iterable collection of vpnAFConfigs
- * @return true or false if one with the given route target to delete is
- * successfully
- */
- boolean removeVpnAfConfigs(Iterable routeTarget);
-
- /**
- * process gluon config for vpn af configuration.
- *
- * @param action can be either update or delete
- * @param key can contain the id and also target information
- * @param value content of the route targets configuration
- */
- void processGluonConfig(String action, String key, JsonNode value);
-
- /**
- * Adds the specified listener to Vpn Port manager.
- *
- * @param listener vpn af config listener
- */
- void addListener(VpnAfConfigListener listener);
-
- /**
- * Removes the specified listener to vpn af config manager.
- *
- * @param listener vpn af config listener
- */
- void removeListener(VpnAfConfigListener listener);
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/VpnAfConfigManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/VpnAfConfigManager.java
deleted file mode 100644
index a2ee02ca90..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/VpnAfConfigManager.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpnafconfig.impl;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.CoreService;
-import org.onosproject.evpnopenflow.rsc.DefaultVpnAfConfig;
-import org.onosproject.evpnopenflow.rsc.VpnAfConfig;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigEvent;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigListener;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigService;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.APP_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DELETE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVENT_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_VPN_AF_CONFIG_START;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_VPN_AF_CONFIG_STOP;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EXPORT_ROUTE_POLICY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IMPORT_ROUTE_POLICY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INVALID_ACTION_VPN_AF_CONFIG;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.JSON_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.LISTENER_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RESPONSE_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_TARGET_CANNOT_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_TARGET_DELETE_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_TARGET_VALUE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SLASH;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.UPDATE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_CONFIG_CREATION_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_CONFIG_IS_NOT_EXIST;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_CONFIG_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_CONFIG_STORE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_AF_CONFIG_UPDATE_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_ID_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VRF_RT_TYPE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VRF_RT_VALUE;
-
-/**
- * Provides implementation of the VPN af config APIs.
- */
-@Component(immediate = true, service = VpnAfConfigService.class)
-public class VpnAfConfigManager implements VpnAfConfigService {
- private final Logger log = LoggerFactory.getLogger(getClass());
- private final Set listeners = Sets
- .newCopyOnWriteArraySet();
-
- protected EventuallyConsistentMap
- vpnAfConfigStore;
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected CoreService coreService;
-
- @Activate
- public void activate() {
- coreService.registerApplication(APP_ID);
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API).register(VpnAfConfig.class)
- .register(VpnRouteTarget.class);
- vpnAfConfigStore = storageService
- .eventuallyConsistentMapBuilder()
- .withName(VPN_AF_CONFIG_STORE).withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp())
- .build();
- log.info(EVPN_VPN_AF_CONFIG_START);
- }
-
- @Deactivate
- public void deactivate() {
- vpnAfConfigStore.destroy();
- log.info(EVPN_VPN_AF_CONFIG_STOP);
- }
-
- @Override
- public boolean exists(VpnRouteTarget routeTarget) {
- checkNotNull(routeTarget, ROUTE_TARGET_CANNOT_NOT_NULL);
- return vpnAfConfigStore.containsKey(routeTarget);
- }
-
- @Override
- public VpnAfConfig getVpnAfConfig(VpnRouteTarget routeTarget) {
- checkNotNull(routeTarget, ROUTE_TARGET_CANNOT_NOT_NULL);
- return vpnAfConfigStore.get(routeTarget);
- }
-
- @Override
- public Collection getVpnAfConfigs() {
- return Collections.unmodifiableCollection(vpnAfConfigStore.values());
- }
-
- @Override
- public boolean createVpnAfConfigs(Iterable vpnAfConfigs) {
- checkNotNull(vpnAfConfigs, VPN_AF_CONFIG_NOT_NULL);
- for (VpnAfConfig vpnAfConfig : vpnAfConfigs) {
- log.info(ROUTE_TARGET_VALUE, vpnAfConfig
- .routeTarget().getRouteTarget());
- vpnAfConfigStore.put(vpnAfConfig.routeTarget(), vpnAfConfig);
- if (!vpnAfConfigStore.containsKey(vpnAfConfig.routeTarget())) {
- log.info(VPN_AF_CONFIG_CREATION_FAILED,
- vpnAfConfig.routeTarget().getRouteTarget());
- return false;
- }
- notifyListeners(new VpnAfConfigEvent(VpnAfConfigEvent
- .Type
- .VPN_AF_CONFIG_SET,
- vpnAfConfig));
- }
- return true;
- }
-
- @Override
- public boolean updateVpnAfConfigs(Iterable vpnAfConfigs) {
- checkNotNull(vpnAfConfigs, VPN_AF_CONFIG_NOT_NULL);
- for (VpnAfConfig vpnAfConfig : vpnAfConfigs) {
- if (!vpnAfConfigStore.containsKey(vpnAfConfig.routeTarget())) {
- log.info(VPN_AF_CONFIG_IS_NOT_EXIST,
- vpnAfConfig.routeTarget().getRouteTarget());
- return false;
- }
- vpnAfConfigStore.put(vpnAfConfig.routeTarget(), vpnAfConfig);
- if (!vpnAfConfig.equals(vpnAfConfigStore
- .get(vpnAfConfig.routeTarget()))) {
- log.info(VPN_AF_CONFIG_UPDATE_FAILED,
- vpnAfConfig.routeTarget().getRouteTarget());
- return false;
- }
- notifyListeners(new VpnAfConfigEvent(VpnAfConfigEvent
- .Type
- .VPN_AF_CONFIG_UPDATE,
- vpnAfConfig));
- }
- return true;
- }
-
- @Override
- public boolean removeVpnAfConfigs(Iterable routeTargets) {
- checkNotNull(routeTargets, VPN_INSTANCE_ID_NOT_NULL);
- for (VpnRouteTarget routeTarget : routeTargets) {
- VpnAfConfig vpnAfConfig = vpnAfConfigStore.get(routeTarget);
- vpnAfConfigStore.remove(routeTarget);
- if (vpnAfConfigStore.containsKey(routeTarget)) {
- log.info(ROUTE_TARGET_DELETE_FAILED,
- routeTarget.getRouteTarget());
- return false;
- }
- notifyListeners(new VpnAfConfigEvent(VpnAfConfigEvent
- .Type
- .VPN_AF_CONFIG_DELETE,
- vpnAfConfig));
- }
- return true;
- }
-
- @Override
- public void processGluonConfig(String action, String key, JsonNode value) {
- Collection vpnAfConfigs;
- switch (action) {
- case DELETE:
- String[] list = key.split(SLASH);
- VpnRouteTarget routeTarget = VpnRouteTarget
- .routeTarget(list[list.length - 1]);
- Set routeTargets
- = Sets.newHashSet(routeTarget);
- removeVpnAfConfigs(routeTargets);
- break;
- case SET:
- checkNotNull(value, RESPONSE_NOT_NULL);
- vpnAfConfigs = changeJsonToSub(value);
- createVpnAfConfigs(vpnAfConfigs);
- break;
- case UPDATE:
- checkNotNull(value, RESPONSE_NOT_NULL);
- vpnAfConfigs = changeJsonToSub(value);
- updateVpnAfConfigs(vpnAfConfigs);
- break;
- default:
- log.info(INVALID_ACTION_VPN_AF_CONFIG);
- break;
- }
- }
-
- /**
- * Returns a collection of vpn af configuration.
- *
- * @param vpnAfConfigNode the vpn af configuration json node
- * @return returns the collection of vpn af configuration
- */
- private Collection changeJsonToSub(JsonNode vpnAfConfigNode) {
- checkNotNull(vpnAfConfigNode, JSON_NOT_NULL);
- Map vpnAfConfigMap = new HashMap<>();
- String exportRoutePolicy
- = vpnAfConfigNode.get(EXPORT_ROUTE_POLICY).asText();
- String importRoutePolicy
- = vpnAfConfigNode.get(IMPORT_ROUTE_POLICY).asText();
- String routeTargetType = vpnAfConfigNode.get(VRF_RT_TYPE).asText();
- VpnRouteTarget routeTarget = VpnRouteTarget
- .routeTarget(vpnAfConfigNode.get(VRF_RT_VALUE).asText());
-
- VpnAfConfig vpnAfConfig = new DefaultVpnAfConfig(exportRoutePolicy,
- importRoutePolicy,
- routeTarget,
- routeTargetType);
- vpnAfConfigMap.put(routeTarget, vpnAfConfig);
-
- return Collections.unmodifiableCollection(vpnAfConfigMap.values());
- }
-
- @Override
- public void addListener(VpnAfConfigListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(VpnAfConfigListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event vpn af config event
- */
- private void notifyListeners(VpnAfConfigEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- listeners.forEach(listener -> listener.event(event));
- }
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/package-info.java
deleted file mode 100644
index f2dd128674..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * VPN af configuration that used by l3vpn.
- */
-package org.onosproject.evpnopenflow.rsc.vpnafconfig.impl;
\ No newline at end of file
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/package-info.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/package-info.java
deleted file mode 100644
index 7c2e4f4cc3..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpnafconfig/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * VPN resources that used by Evpn.
- */
-package org.onosproject.evpnopenflow.rsc.vpnafconfig;
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/VpnInstanceService.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/VpnInstanceService.java
deleted file mode 100644
index a61a811587..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/VpnInstanceService.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpninstance;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.onosproject.evpnopenflow.rsc.VpnInstance;
-import org.onosproject.evpnopenflow.rsc.VpnInstanceId;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * Service for interacting with the inventory of VPN instance.
- */
-public interface VpnInstanceService {
- /**
- * Returns if the vpnInstance is existed.
- *
- * @param vpnInstanceId vpnInstance identifier
- * @return true or false if one with the given identifier is not existed.
- */
- boolean exists(VpnInstanceId vpnInstanceId);
-
- /**
- * Returns the vpnInstance with the identifier.
- *
- * @param vpnInstanceId vpnInstance ID
- * @return VpnInstance or null if one with the given ID is not know.
- */
- VpnInstance getInstance(VpnInstanceId vpnInstanceId);
-
- /**
- * Returns the collection of the currently known vpnInstance.
- *
- * @return collection of VpnInstance.
- */
- Collection getInstances();
-
- /**
- * Creates vpnInstances by vpnInstances.
- *
- * @param vpnInstances the iterable collection of vpnInstances
- * @return true if all given identifiers created successfully.
- */
- boolean createInstances(Iterable vpnInstances);
-
- /**
- * Updates vpnInstances by vpnInstances.
- *
- * @param vpnInstances the iterable collection of vpnInstances
- * @return true if all given identifiers updated successfully.
- */
- boolean updateInstances(Iterable vpnInstances);
-
- /**
- * Deletes vpnInstanceIds by vpnInstanceIds.
- *
- * @param vpnInstanceIds the iterable collection of vpnInstance identifiers
- * @return true or false if one with the given identifier to delete is
- * successfully.
- */
- boolean removeInstances(Iterable vpnInstanceIds);
-
- /**
- * process gluon config for vpn instance information.
- *
- * @param action can be either update or delete
- * @param key can contain the id and also target information
- * @param value content of the vpn instance configuration
- */
- void processGluonConfig(String action, String key, JsonNode value);
-
- /**
- * process Etcd response for vpn instance information.
- *
- * @param routeTargetType route target type
- * @param exportRouteTargets export route targets
- * @param importRouteTargets import route targets
- * @param vpnRouteTarget vpn route target
- */
- void updateImpExpRouteTargets(String routeTargetType,
- Set exportRouteTargets,
- Set importRouteTargets,
- VpnRouteTarget vpnRouteTarget);
-}
diff --git a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/impl/VpnInstanceManager.java b/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/impl/VpnInstanceManager.java
deleted file mode 100644
index 91eba1d87e..0000000000
--- a/apps/evpnopenflow/src/main/java/org/onosproject/evpnopenflow/rsc/vpninstance/impl/VpnInstanceManager.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.evpnopenflow.rsc.vpninstance.impl;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.evpnopenflow.rsc.DefaultVpnInstance;
-import org.onosproject.evpnopenflow.rsc.VpnAfConfig;
-import org.onosproject.evpnopenflow.rsc.VpnInstance;
-import org.onosproject.evpnopenflow.rsc.VpnInstanceId;
-import org.onosproject.evpnopenflow.rsc.vpnafconfig.VpnAfConfigService;
-import org.onosproject.evpnopenflow.rsc.vpninstance.VpnInstanceService;
-import org.onosproject.evpnrouteservice.EvpnInstanceName;
-import org.onosproject.evpnrouteservice.RouteDistinguisher;
-import org.onosproject.evpnrouteservice.VpnRouteTarget;
-import org.onosproject.routeservice.RouteAdminService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.APP_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.COMMA;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DELETE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.DESCRIPTION;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_VPN_INSTANCE_START;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.EVPN_VPN_INSTANCE_STOP;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.INSTANCE_ID;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.IPV4_FAMILY;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.JSON_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.RESPONSE_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.ROUTE_DISTINGUISHERS;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SET;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.SLASH;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.UPDATE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_CREATION_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_DELETE_FAILED;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_ID_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_IS_NOT_EXIST;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_NAME;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_NOT_NULL;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_STORE;
-import static org.onosproject.evpnopenflow.rsc.EvpnConstants.VPN_INSTANCE_UPDATE_FAILED;
-
-
-/**
- * Provides implementation of the VpnInstance APIs.
- */
-@Component(immediate = true, service = VpnInstanceService.class)
-public class VpnInstanceManager implements VpnInstanceService {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- protected EventuallyConsistentMap vpnInstanceStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected RouteAdminService routeService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY)
- protected VpnAfConfigService vpnAfConfigService;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(APP_ID);
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API).register(VpnInstance.class)
- .register(VpnInstanceId.class);
- vpnInstanceStore = storageService
- .