summaryrefslogtreecommitdiffstats
path: root/fabric-discovery-plugin/provider
diff options
context:
space:
mode:
authorArun S. Yerra <arun.yerra@huawei.com>2017-11-06 14:56:45 -0800
committerArun S. Yerra <arun.yerra@huawei.com>2017-11-06 14:58:12 -0800
commit5abb631c6cb327eb420c6a61c0b98270c673f730 (patch)
tree84b733a2fe35f69877aa38c06401dac5fde40bee /fabric-discovery-plugin/provider
parent9c6ec0e0a2f3439cef2d7891f5121c51ce236ab0 (diff)
Purging Fabric discovery plugin codev0.1.01.0.0-ONAP1.0.0-Amsterdam
Two files in Fabric Discovery plugin has license issue. Purging this feature for R1 release, as this feature is not being used in R1 release and will be reworked in R2 release. Change-Id: If92d9c96c01e250e59c2bf99a12b95a9d37b197c Issue-Id: CCSDK-138 Signed-off-by: Arun S. Yerra <arun.yerra@huawei.com>
Diffstat (limited to 'fabric-discovery-plugin/provider')
-rwxr-xr-xfabric-discovery-plugin/provider/pom.xml126
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/ClientMessageCallback.java20
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/FabricDiscoveryPlugin.java150
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IClientMessageCallback.java16
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IFabricDiscoveryService.java17
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClient.java93
-rw-r--r--fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClientHandler.java92
-rw-r--r--fabric-discovery-plugin/provider/src/main/resources/org/opendaylight/blueprint/fabricdiscoveryplugin-blueprint.xml10
-rw-r--r--fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java79
9 files changed, 0 insertions, 603 deletions
diff --git a/fabric-discovery-plugin/provider/pom.xml b/fabric-discovery-plugin/provider/pom.xml
deleted file mode 100755
index c38acb1b..00000000
--- a/fabric-discovery-plugin/provider/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.sli.plugins</groupId>
- <artifactId>fabric-discovery-plugin</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.ccsdk.sli.plugins</groupId>
- <artifactId>fabric-discovery-plugin-provider</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Fabric Discovery Plugin - Provider</name>
- <url>http://maven.apache.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <!-- https://mvnrepository.com/artifact/io.netty/netty -->
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.10.6.Final</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/io.netty/netty-buffer -->
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- <version>4.0.26.Final</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/io.netty/netty-transport -->
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-transport</artifactId>
- <version>4.0.4.Final</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/io.netty/netty-codec-http -->
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-codec-http</artifactId>
- <version>4.0.15.Final</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-common</artifactId>
- <version>${sdnctl.sli.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- <version>${sdnctl.sli.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jettison</groupId>
- <artifactId>jettison</artifactId>
- <version>${jettison.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-common</artifactId>
- <version>${sdnctl.sli.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- <version>${sdnctl.sli.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.onap.ccsdk.sli.plugins.fabricdiscovery</Bundle-SymbolicName>
- <Export-Package>org.onap.ccsdk.sli.plugins.fabricdiscovery</Export-Package>
- <Import-Package>*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/ClientMessageCallback.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/ClientMessageCallback.java
deleted file mode 100644
index 0a8ba9e7..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/ClientMessageCallback.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
-
-/**
- * Created by arun on 9/9/17.
- */
-public class ClientMessageCallback implements IClientMessageCallback {
- private static final Logger LOG = LoggerFactory.getLogger(ClientMessageCallback.class);
-
- @Override
- public void onMessageReceived(final Object message) {
- if (message instanceof TextWebSocketFrame) {
- LOG.info("received message {}" + ((TextWebSocketFrame) message).text());
- }
- }
-
-}
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/FabricDiscoveryPlugin.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/FabricDiscoveryPlugin.java
deleted file mode 100644
index 99e171f6..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/FabricDiscoveryPlugin.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class FabricDiscoveryPlugin implements SvcLogicJavaPlugin, IFabricDiscoveryService {
-
- private ExecutorService service;
- private Map<String, WebSocketClient> streamMap;
- private static final Logger LOG = LoggerFactory.getLogger(FabricDiscoveryPlugin.class);
- private static final String STREAM_PREFIX = "ws://";
- private static final String FB_DISCOVERY_STATUS = "fb-response";
-
- public FabricDiscoveryPlugin() {
- service = Executors.newFixedThreadPool(10);
- streamMap = new ConcurrentHashMap<>();
- }
-
- @Override
- public void processDcNotificationStream (Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException {
- boolean enable;
- String stream = parseParam(paramMap, "stream", true, null);
- String prefix = parseParam(paramMap, "contextPrefix", false, null);
- String enableStr = parseParam(paramMap, "enable", true, null);
-
- // Validate the input parameters
- String pfx = (prefix != null) ? prefix + '.' : "";
- if ("true".equalsIgnoreCase(enableStr)) {
- enable = true;
- } else if ("false".equalsIgnoreCase(enableStr)) {
- enable = false;
- } else {
- ctx.setAttribute(pfx + FB_DISCOVERY_STATUS, "Failure");
- throw new SvcLogicException("Incorrect parameter: enable. Valid values are ['true', 'false']");
- }
- if (!STREAM_PREFIX.equalsIgnoreCase(stream.substring(0, 5))) {
- ctx.setAttribute(pfx + FB_DISCOVERY_STATUS, "Failure");
- throw new SvcLogicException("Incorrect parameter: stream, Input is not a web socket address");
- }
-
- ctx.setAttribute(pfx + FB_DISCOVERY_STATUS, "Success");
- LOG.info("{} monitoring notification stream: {}", enable ? "START" : "STOP", stream);
-
- try {
- service.execute(new Runnable () {
- public void run () {
- try {
- URI uri = new URI(stream);
- if (enable) {
- if (streamMap.get(stream) != null) {
- LOG.info("Notification Stream: {} is already being monitoried", stream);
- return;
- }
- IClientMessageCallback messageCallback = new ClientMessageCallback();
- WebSocketClient wcClient = new WebSocketClient(uri, messageCallback);
- streamMap.put(stream, wcClient);
- wcClient.initialize();
- try {
- wcClient.connect();
- } catch (InterruptedException e) {
- LOG.info("Web Socket Client throws Exception: ", e.getMessage());
- }
- } else {
- WebSocketClient wc = streamMap.get(stream);
- if (wc != null) {
- try {
- wc.close("Closing");
- } catch (InterruptedException e) {
- LOG.info("Web Socket Client throws Exception: ", e.getMessage());
- }
- }
- }
- } catch (URISyntaxException e) {
- LOG.info("Exception converting stream to URI with: ", e.getMessage());
- }
- }
- });
- } catch (Exception e) {
- LOG.info("Web Socket client connection throws an exception: ", e.getMessage());
- }
- }
-
- private String parseParam(Map<String, String> paramMap, String name, boolean required, String def)
- throws SvcLogicException {
- String s = paramMap.get(name);
-
- if (s == null || s.trim().length() == 0) {
- if (!required)
- return def;
- throw new SvcLogicException("Parameter " + name + " is required in PropertiesNode");
- }
-
- s = s.trim();
- String value = "";
- int i = 0;
- int i1 = s.indexOf('%');
- while (i1 >= 0) {
- int i2 = s.indexOf('%', i1 + 1);
- if (i2 < 0)
- throw new SvcLogicException("Cannot parse parameter " + name + ": " + s + ": no matching %");
-
- String varName = s.substring(i1 + 1, i2);
- String varValue = System.getenv(varName);
- if (varValue == null)
- varValue = "";
-
- value = (new StringBuilder()).append(value)
- .append(s.substring(i, i1))
- .append(varValue).toString();
- i = i2 + 1;
- i1 = s.indexOf('%', i);
- }
- value = (new StringBuilder()).append(value)
- .append(s.substring(i)).toString();
-
- LOG.info("Parameter {}: {}", name, value);
- return value;
- }
-}
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IClientMessageCallback.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IClientMessageCallback.java
deleted file mode 100644
index e555d338..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IClientMessageCallback.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-/**
- * Created by mbobak on 1/22/14.
- */
-public interface IClientMessageCallback {
-
- void onMessageReceived(Object message);
-}
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IFabricDiscoveryService.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IFabricDiscoveryService.java
deleted file mode 100644
index 857d75a9..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/IFabricDiscoveryService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-/**
- * Created by arun on 9/10/17.
- */
-public interface IFabricDiscoveryService {
-
- /* (non-Javadoc)
- * @see void#processDcNotificationStream(java.lang.String, java.lang.Integer, java.lang.String, java.lang.Boolean)
- */
- void processDcNotificationStream (Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException;
-
-}
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClient.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClient.java
deleted file mode 100644
index d5bab386..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClient.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import io.netty.bootstrap.Bootstrap;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelPipeline;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.codec.http.HttpClientCodec;
-import io.netty.handler.codec.http.HttpObjectAggregator;
-import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.PingWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
-import io.netty.handler.codec.http.websocketx.WebSocketVersion;
-import java.net.URI;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebSocketClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebSocketClient.class);
-
- private final URI uri;
- private final Bootstrap bootstrap = new Bootstrap();
- private final WebSocketClientHandler clientHandler;
- private Channel clientChannel;
- private final EventLoopGroup group = new NioEventLoopGroup();
-
- public WebSocketClient(final URI uri, final IClientMessageCallback clientMessageCallback) {
- this.uri = uri;
- clientHandler = new WebSocketClientHandler(WebSocketClientHandshakerFactory.newHandshaker(uri,
- WebSocketVersion.V13, null, false, null), clientMessageCallback);
- // last null could be replaced with DefaultHttpHeaders
- initialize();
- }
-
- public void initialize() {
-
- String protocol = uri.getScheme();
- if (!"ws".equals(protocol)) {
- throw new IllegalArgumentException("Unsupported protocol: " + protocol);
- }
-
- bootstrap.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {
- @Override
- public void initChannel(final SocketChannel ch) throws Exception {
- ChannelPipeline pipeline = ch.pipeline();
- pipeline.addLast("http-codec", new HttpClientCodec());
- pipeline.addLast("aggregator", new HttpObjectAggregator(8192));
- pipeline.addLast("ws-handler", clientHandler);
- }
- });
- }
-
- public void connect() throws InterruptedException {
- LOG.info("WebSocket Client connecting");
- clientChannel = bootstrap.connect(uri.getHost(), uri.getPort()).sync().channel();
- clientHandler.handshakeFuture().sync();
- }
-
- public void writeAndFlush(final String message) {
- clientChannel.writeAndFlush(new TextWebSocketFrame(message));
- }
-
- public void writeAndFlush(final Object message) {
- clientChannel.writeAndFlush(message);
- }
-
- public void ping() {
- clientChannel.writeAndFlush(new PingWebSocketFrame(Unpooled.copiedBuffer(new byte[] { 1, 2, 3, 4, 5, 6 })));
- }
-
- public void close(final String reasonText) throws InterruptedException {
- CloseWebSocketFrame closeWebSocketFrame = new CloseWebSocketFrame(1000, reasonText);
- clientChannel.writeAndFlush(closeWebSocketFrame);
-
- // WebSocketClientHandler will close the connection when the server
- // responds to the CloseWebSocketFrame.
- clientChannel.closeFuture().sync();
- group.shutdownGracefully();
- }
-}
diff --git a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClientHandler.java b/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClientHandler.java
deleted file mode 100644
index c1c5dc30..00000000
--- a/fabric-discovery-plugin/provider/src/main/java/org/onap/ccsdk/sli/plugins/fabricdiscovery/WebSocketClientHandler.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelPromise;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.codec.http.FullHttpResponse;
-import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.PongWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
-import io.netty.handler.codec.http.websocketx.WebSocketFrame;
-import io.netty.util.CharsetUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebSocketClientHandler.class.toString());
- private final WebSocketClientHandshaker handshaker;
- private ChannelPromise handshakeFuture;
- private final IClientMessageCallback messageListener;
-
- public WebSocketClientHandler(WebSocketClientHandshaker handshaker, IClientMessageCallback listener) {
- this.handshaker = handshaker;
- this.messageListener = listener;
- }
-
- public ChannelFuture handshakeFuture() {
- return handshakeFuture;
- }
-
- @Override
- public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
- handshakeFuture = ctx.newPromise();
- }
-
- @Override
- public void channelActive(ChannelHandlerContext ctx) throws Exception {
- handshaker.handshake(ctx.channel());
- }
-
- @Override
- public void channelInactive(ChannelHandlerContext ctx) throws Exception {
- LOG.info("WebSocket Client disconnected!");
- }
-
- @Override
- public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
- Channel ch = ctx.channel();
- if (!handshaker.isHandshakeComplete()) {
- handshaker.finishHandshake(ch, (FullHttpResponse) msg);
- LOG.info("WebSocket Client connected!");
- handshakeFuture.setSuccess();
- return;
- }
-
- if (msg instanceof FullHttpResponse) {
- FullHttpResponse response = (FullHttpResponse) msg;
- throw new Exception("Unexpected FullHttpResponse (getStatus=" + response.getStatus() + ", content="
- + response.content().toString(CharsetUtil.UTF_8) + ')');
- }
-
- messageListener.onMessageReceived(msg);
- WebSocketFrame frame = (WebSocketFrame) msg;
-
- if (frame instanceof PongWebSocketFrame) {
- LOG.info("WebSocket Client received pong");
- } else if (frame instanceof CloseWebSocketFrame) {
- LOG.info("WebSocket Client received closing");
- ch.close();
- }
- }
-
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
- LOG.info("Cause: {} .", cause.toString());
-
- if (!handshakeFuture.isDone()) {
- handshakeFuture.setFailure(cause);
- }
-
- ctx.close();
- }
-}
diff --git a/fabric-discovery-plugin/provider/src/main/resources/org/opendaylight/blueprint/fabricdiscoveryplugin-blueprint.xml b/fabric-discovery-plugin/provider/src/main/resources/org/opendaylight/blueprint/fabricdiscoveryplugin-blueprint.xml
deleted file mode 100644
index 43137bb8..00000000
--- a/fabric-discovery-plugin/provider/src/main/resources/org/opendaylight/blueprint/fabricdiscoveryplugin-blueprint.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
-
- <bean id="fabricDiscoveryPlugin" class="org.onap.ccsdk.sli.plugins.fabricdiscovery.FabricDiscoveryPlugin" />
- <service ref="fabricDiscoveryPlugin" interface="org.onap.ccsdk.sli.plugins.fabricdiscovery.FabricDiscoveryPlugin" />
-
-</blueprint>
diff --git a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java
deleted file mode 100644
index 7a25e77b..00000000
--- a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package jtest.org.onap.ccsdk.sli.plugins.fabricdiscovery;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.plugins.fabricdiscovery.FabricDiscoveryPlugin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Created by arun on 9/18/17.
- */
-
-public class TestFabricDiscoveryPlugin {
- private static final Logger LOG = LoggerFactory.getLogger(TestFabricDiscoveryPlugin.class);
- private static final String C_STREAM =
- "ws://localhost:8185/data-change-event-subscription/network-topology:network-topology/datastore=CONFIGURATION/scope=BASE";
- private static final String W_STREAM =
- "get://localhost:8185/data-change-event-subscription/network-topology:network/datastore=CONFIGURATION/scope=BASE";
- private final String FB_DISCOVERY_STATUS = "fb-response";
-
- @Test
- public void connectToNotificationServerSuccess() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- String stream = C_STREAM;
-
- Map<String, String> p = new HashMap<String, String>();
- p.put("stream", stream);
- p.put("enable", "true");
-
- FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin();
- fdp.processDcNotificationStream(p, ctx);
- Assert.assertEquals("Success", ctx.getAttribute(FB_DISCOVERY_STATUS));
- }
-
- @Test
- public void connectToNotificationServerFailure() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- String stream = W_STREAM;
-
- Map<String, String> p = new HashMap<>();
- p.put("stream", stream);
- p.put("enable", "true");
-
- FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin();
- try {
- fdp.processDcNotificationStream(p, ctx);
- LOG.info("Connection to Stream:{} succeeded.", stream);
- } catch (Exception e) {
- LOG.info("Received Exception while connecting to Fabric Discovery notification server: {}", e.getMessage());
- } finally {
- Assert.assertEquals("Failure", ctx.getAttribute(FB_DISCOVERY_STATUS));
- }
- }
-
- @Test
- public void validateParameterEnableFailure() throws Exception {
- SvcLogicContext ctx = new SvcLogicContext();
- String stream = C_STREAM;
- final String W_ENABLE_STR = "bad enable parameter";
-
- Map<String, String> p = new HashMap<>();
- p.put("stream", stream);
- p.put("enable", W_ENABLE_STR);
-
- FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin();
- try {
- fdp.processDcNotificationStream(p, ctx);
- LOG.info("Connection to Stream:{} succeeded.", stream);
- } catch (Exception e) {
- LOG.info("Received Exception while connecting to Fabric Discovery notification server: {}", e.getMessage());
- } finally {
- Assert.assertEquals("Failure", ctx.getAttribute(FB_DISCOVERY_STATUS));
- }
- }
-
-}