diff options
author | 2017-12-13 11:14:21 -0800 | |
---|---|---|
committer | 2017-12-13 11:14:31 -0800 | |
commit | 161df8a94bb3b0c34ed16fd4fdba078bd1eeef9a (patch) | |
tree | 21f410d053d5e390902d72bb3ebe6889451dd633 /appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp | |
parent | 0756759f39e125b02d63b4e93de83b3c6b13beea (diff) |
Second part of onap rename
This is the second commit of the rename. The folder structure
is renamed for appc-adapters and appc-config in this commit.
Change-Id: Iaa2b8c937ff1ca1b5d1178128961fb115ee65d9b
Signed-off-by: Patrick Brady <pb071s@att.com>
Issue-ID: APPC-13
Diffstat (limited to 'appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp')
6 files changed, 0 insertions, 530 deletions
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/internal/TestNetconfAdapter.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/internal/TestNetconfAdapter.java deleted file mode 100644 index cb20cbdb5..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/internal/TestNetconfAdapter.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.internal; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.appc.adapter.netconf.internal.NetconfAdapter; - -import java.io.IOException; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; - -public class TestNetconfAdapter { - - private static final String EOM = "]]>]]>"; - - @Test - public void testReceiveMessage() throws IOException { - PipedOutputStream pos = new PipedOutputStream(); - PipedInputStream is = new PipedInputStream(pos); - - PipedInputStream pis = new PipedInputStream(); - PipedOutputStream os = new PipedOutputStream(pis); - - NetconfAdapter netconfAdapter = new NetconfAdapter(is, os); - - String request = "Hello, netconf!"; - pos.write(request.getBytes()); - pos.write(EOM.getBytes()); - String response = netconfAdapter.receiveMessage(); - Assert.assertNotNull(response); - Assert.assertEquals(request, response.trim()); - } - - @Test - public void testSendMessage() throws IOException { - PipedOutputStream pos = new PipedOutputStream(); - PipedInputStream is = new PipedInputStream(pos); - - PipedInputStream pis = new PipedInputStream(); - PipedOutputStream os = new PipedOutputStream(pis); - - NetconfAdapter netconfAdapter = new NetconfAdapter(is, os); - - String request = "Hello, netconf!"; - netconfAdapter.sendMessage(request); - byte[] bytes = new byte[request.length()+EOM.length()+2]; - int count = pis.read(bytes); - String response = new String(bytes, 0, count); - Assert.assertNotNull(response); - Assert.assertTrue(response.endsWith(EOM)); - response = response.substring(0, response.length() - EOM.length()).trim(); - Assert.assertEquals(request, response); - } - - @Test - public void testSendReceive() throws IOException { - PipedOutputStream os = new PipedOutputStream(); - PipedInputStream is = new PipedInputStream(os); - - NetconfAdapter netconfAdapter = new NetconfAdapter(is, os); - - String request = "Hello, netconf!"; - netconfAdapter.sendMessage(request); - String response = netconfAdapter.receiveMessage(); - Assert.assertNotNull(response); - Assert.assertEquals(request, response.trim()); - } -} diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestGetRunningConfig.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestGetRunningConfig.java deleted file mode 100644 index b559bc749..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestGetRunningConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.jsch; - -import java.util.Collections; -import java.util.List; - -import org.onap.appc.adapter.netconf.NetconfConnectionDetails; -import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch; -import org.onap.appc.exceptions.APPCException; - -public class TestGetRunningConfig { - - private static final String HOST = "192.168.1.2"; - private static final String USER = "test"; - private static final String PSWD = "test123"; - private static final int PORT = 830; - private static final List<String> CAPABILITIES = Collections.singletonList("<capability>urn:org:onap:appc:capability:1.1.0</capability>"); - - public static void main(String[] args) throws APPCException { - try { - NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails(); - connectionDetails.setHost(HOST); - connectionDetails.setPort(PORT); - connectionDetails.setUsername(USER); - connectionDetails.setPassword(PSWD); - connectionDetails.setCapabilities(CAPABILITIES); - NetconfClientJsch netconfClientJsch = new NetconfClientJsch(); - netconfClientJsch.connect(connectionDetails); - try { - System.out.println("=> Running get configuration..."); - String configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - } finally { - netconfClientJsch.disconnect(); - } - } catch(Exception e) { - e.printStackTrace(); - } - } -} diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfig.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfig.java deleted file mode 100644 index 809625333..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfig.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.jsch; - -import java.util.Collections; -import java.util.List; - -import org.onap.appc.adapter.netconf.NetconfConnectionDetails; -import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch; -import org.onap.appc.exceptions.APPCException; - -public class TestModifyConfig { - - private static final String HOST = "192.168.1.2"; - private static final String USER = "test"; - private static final String PSWD = "test123"; - private static final int PORT = 830; - private static final List<String> CAPABILITIES = Collections.singletonList("<capability>urn:org:onap:appc:capability:1.1.0</capability>"); - private static final String CONFIG = - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" + - " <edit-config>\n" + - " <target>\n" + - " <running />\n" + - " </target>\n" + - " <default-operation>merge</default-operation>\n" + - " <config xmlns:xc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + - " <ManagedElement xmlns=\"urn:org.onap.appc:Test\">\n" + - " <managedElementId>1</managedElementId>\n" + - " <VnfFunction xmlns=\"urn:org:onap:appc:VnfFunction\">\n" + - " <id>1</id>\n" + - " <Interfaces>\n" + - " <id>1</id>\n" + - " <DiaRealmRf>\n" + - " <realm>example.com</realm>\n" + - " <reconnectTimer>60</reconnectTimer>\n" + - " </DiaRealmRf>\n" + - " </Interfaces>\n" + - " </VnfFunction>\n" + - " </ManagedElement>\n" + - " </config>\n" + - " </edit-config>\n" + - "</rpc>"; - - public static void main(String[] args) throws APPCException { - try { - NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails(); - connectionDetails.setHost(HOST); - connectionDetails.setPort(PORT); - connectionDetails.setUsername(USER); - connectionDetails.setPassword(PSWD); - connectionDetails.setCapabilities(CAPABILITIES); - NetconfClientJsch netconfClientJsch = new NetconfClientJsch(); - netconfClientJsch.connect(connectionDetails); - try { - System.out.println("=> Running get configuration..."); - String configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - - System.out.println("=> Reconfiguring device..."); - String outMessage = netconfClientJsch.exchangeMessage(CONFIG); - System.out.println("=> Reconfiguration response:\n" + outMessage); - - System.out.println("=> Running get configuration..."); - configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - } finally { - netconfClientJsch.disconnect(); - } - } catch(Exception e) { - e.printStackTrace(); - } - } -} diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigMock.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigMock.java deleted file mode 100644 index 915721d51..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigMock.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.jsch; - -import java.util.Collections; -import java.util.List; - -import org.onap.appc.adapter.netconf.NetconfConnectionDetails; -import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch; -import org.onap.appc.exceptions.APPCException; - -public class TestModifyConfigMock { - - private static final String HOST = "192.168.1.2"; - private static final String USER = "test"; - private static final String PSWD = "test123"; - private static final int PORT = 830; - private static final List<String> CAPABILITIES = Collections.singletonList("<capability>urn:org:onap:appc:capability:1.1.0</capability>"); - private static final String CONFIG = - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" + - " <edit-config>\n" + - " <target>\n" + - " <running />\n" + - " </target>\n" + - " <default-operation>merge</default-operation>\n" + - " <config xmlns:xc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + - " <ManagedElement xmlns=\"urn:org.onap.appc:Test\">\n" + - " <managedElementId>1</managedElementId>\n" + - " <VnfFunction xmlns=\"urn:org:onap:appc:VnfFunction\">\n" + - " <id>1</id>\n" + - " <Interfaces>\n" + - " <id>1</id>\n" + - " <DiaRealmRf>\n" + - " <realm>example.com</realm>\n" + - " <reconnectTimer>60</reconnectTimer>\n" + - " </DiaRealmRf>\n" + - " </Interfaces>\n" + - " </VnfFunction>\n" + - " </ManagedElement>\n" + - " </config>\n" + - " </edit-config>\n" + - "</rpc>"; - - public static void main(String[] args) throws APPCException { - try { - NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails(); - connectionDetails.setHost(HOST); - connectionDetails.setPort(PORT); - connectionDetails.setUsername(USER); - connectionDetails.setPassword(PSWD); - connectionDetails.setCapabilities(CAPABILITIES); - NetconfClientJsch netconfClientJsch = new NetconfClientJsch(); - netconfClientJsch.connect(connectionDetails); - try { - System.out.println("=> Running get configuration..."); - String configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - - System.out.println("=> Reconfiguring device..."); - String outMessage = netconfClientJsch.exchangeMessage(CONFIG); - System.out.println("=> Reconfiguration response:\n" + outMessage); - - System.out.println("=> Running get configuration..."); - configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - } finally { - netconfClientJsch.disconnect(); - } - } catch(Exception e) { - e.printStackTrace(); - } - } -} diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java deleted file mode 100644 index 83e62bc9f..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestModifyConfigRouterMock.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.jsch; - -import java.util.Collections; -import java.util.List; - -import org.onap.appc.adapter.netconf.NetconfConnectionDetails; -import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch; -import org.onap.appc.exceptions.APPCException; - -public class TestModifyConfigRouterMock { - - private static final String HOST = "10.147.27.50"; // yuma netconf simulator - private static final int PORT = 830; - private static final String USER = "admin"; - private static final String PSWD = "admin"; - private static final List<String> CAPABILITIES = Collections.emptyList(); - private static final String CONFIG = - "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + - " <edit-config>\n" + - " <target>\n" + - " <candidate/>\n" + - " </target>\n" + - " <config xmlns:xc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + - " <router xmlns=\"urn:sdnhub:odl:tutorial:router\">\n" + - " <ospf>\n" + - " <process-id>1</process-id>\n" + - " <networks>\n" + - " <subnet-ip>100.100.100.0/24</subnet-ip>\n" + - " <area-id>10</area-id>\n" + - " </networks>\n" + - " </ospf>\n" + - " <bgp>\n" + - " <as-number>1000</as-number>\n" + - " <router-id>10.10.1.1</router-id>\n" + - " <neighbors>\n" + - " <as-number>2000</as-number>\n" + - " <peer-ip>10.10.1.2</peer-ip>\n" + - " </neighbors>\n" + - " </bgp>\n" + - " </router>\n" + - " </config>\n" + - " </edit-config>\n" + - "</rpc>\n"; - - public static void main(String[] args) throws APPCException { - try { - NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails(); - connectionDetails.setHost(HOST); - connectionDetails.setPort(PORT); - connectionDetails.setUsername(USER); - connectionDetails.setPassword(PSWD); - connectionDetails.setCapabilities(CAPABILITIES); - NetconfClientJsch netconfClientJsch = new NetconfClientJsch(); - netconfClientJsch.connect(connectionDetails); - try { - System.out.println("=> Running get configuration..."); - String configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - - System.out.println("=> Reconfiguring device..."); - String outMessage = netconfClientJsch.exchangeMessage(CONFIG); - System.out.println("=> Reconfiguration response:\n" + outMessage); - } finally { - netconfClientJsch.disconnect(); - } - } catch(Exception e) { - e.printStackTrace(); - } - } -} diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestOperationalStates.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestOperationalStates.java deleted file mode 100644 index 263dd5a8f..000000000 --- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/test/java/org/openecomp/appc/adapter/netconf/jsch/TestOperationalStates.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.adapter.netconf.jsch; - -import java.util.Collections; -import java.util.List; - -import org.onap.appc.adapter.netconf.NetconfConnectionDetails; -import org.onap.appc.adapter.netconf.jsch.NetconfClientJsch; -import org.onap.appc.exceptions.APPCException; - -public class TestOperationalStates { - - private static final String HOST = "192.168.1.2"; - private static final String USER = "test"; - private static final String PSWD = "test123"; - private static final int PORT = 830; - private static final List<String> CAPABILITIES = Collections.singletonList("<capability>urn:org:onap:appc:capability:1.1.0</capability>"); - private static final String GET_OPERATIONAL_STATES = - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + - " <get>\n" + - " <filter>\n" + - " <ManagedElement xmlns=\"urn:org:onap:appc:Test\">\n" + - " <VnfFunction xmlns=\"urn:org:onap:appc:Test\">\n" + - " <ProcessorManagement>\n" + - " <MatedPair>\n" + - " <operationalState/>\n" + - " <PayloadProcessor>\n" + - " <operationalState/>\n" + - " </PayloadProcessor>\n" + - " </MatedPair>\n" + - " <SystemController>\n" + - " <operationalState/>\n" + - " </SystemController>\n" + - " </ProcessorManagement>\n" + - " </VnfFunction>\n" + - " </ManagedElement>\n" + - " </filter>\n" + - " </get>\n" + - "</rpc>"; - - public static void main(String[] args) throws APPCException { - try { - NetconfConnectionDetails connectionDetails = new NetconfConnectionDetails(); - connectionDetails.setHost(HOST); - connectionDetails.setPort(PORT); - connectionDetails.setUsername(USER); - connectionDetails.setPassword(PSWD); - connectionDetails.setCapabilities(CAPABILITIES); - NetconfClientJsch netconfClientJsch = new NetconfClientJsch(); - netconfClientJsch.connect(connectionDetails); - try { - System.out.println("=> Running get configuration..."); - String configuration = netconfClientJsch.getConfiguration(); - System.out.println("=> Configuration:\n" + configuration); - - System.out.println("=> Running get operational states..."); - String outMessage = netconfClientJsch.exchangeMessage(GET_OPERATIONAL_STATES); - System.out.println("=> Operational states:\n" + outMessage); - } finally { - netconfClientJsch.disconnect(); - } - } catch(Exception e) { - e.printStackTrace(); - } - } -} |