Adding topology overlay support for the server-side topo layout app.
Also:
- parametrized access network layout in preparation for multiple variants
- removed WS authentication code temporarily until proper forced-logout is implemented
- updated STC warden environment (test only)
Change-Id: I0adbe60737828db79350e7eb2fc72cf313b78a28
diff --git a/apps/layout/src/main/java/org/onosproject/layout/LayoutOverlayMessageHandler.java b/apps/layout/src/main/java/org/onosproject/layout/LayoutOverlayMessageHandler.java
new file mode 100644
index 0000000..f66f1bd
--- /dev/null
+++ b/apps/layout/src/main/java/org/onosproject/layout/LayoutOverlayMessageHandler.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.layout;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableSet;
+import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.ui.RequestHandler;
+import org.onosproject.ui.UiConnection;
+import org.onosproject.ui.UiMessageHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+
+/**
+ * ONOS UI Layout Topology-Overlay message handler.
+ */
+public class LayoutOverlayMessageHandler extends UiMessageHandler {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private static final String DO_LAYOUT = "doLayout";
+ private static final String TYPE = "type";
+
+ RoleBasedLayoutManager layoutManager;
+
+ @Override
+ public void init(UiConnection connection, ServiceDirectory directory) {
+ super.init(connection, directory);
+ layoutManager = directory.get(RoleBasedLayoutManager.class);
+ }
+
+ @Override
+ protected Collection<RequestHandler> createRequestHandlers() {
+ return ImmutableSet.of(
+ new LayoutHandler()
+ );
+ }
+
+ private final class LayoutHandler extends RequestHandler {
+
+ public LayoutHandler() {
+ super(DO_LAYOUT);
+ }
+
+ @Override
+ public void process(ObjectNode payload) {
+ String algorithm = string(payload, TYPE);
+ switch (algorithm) {
+ case "access":
+ layoutManager.layout(new AccessNetworkLayout());
+ break;
+ default:
+ layoutManager.layout(new DefaultForceLayout());
+ break;
+ }
+ }
+ }
+
+}
\ No newline at end of file