diff options
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test')
47 files changed, 0 insertions, 4868 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java deleted file mode 100644 index a94c80c22..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.fail; -import com.google.common.io.Files; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.AaiProviderClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config.AaiConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.legacy.InventoryInformation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ResourceFileLoader; - -public class TestAai { - - private static final String CONFIGURATIONTESTFILE = "test.properties"; // for - private static final String ENABLEDAAI_TESTCONFIG_FILENAME = "test2.properties"; - private static final File ENABLEDAAI_TESTCONFIG_FILE = new File(ENABLEDAAI_TESTCONFIG_FILENAME); - private static final int AAI_SERVER_PORT=45454; - private static final String TESTCONFIG_CONTENT="[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=off\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=http://localhost:"+AAI_SERVER_PORT+"\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\n" + - "aaiTrustAllCerts=false\n" + - "aaiApiVersion=aai/v13\n" + - "aaiPropertiesFile=aaiclient.properties\n" + - "aaiApplicationId=SDNR\n" + - "aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12\n" + - "aaiPcks12ClientCertPassphrase=adminadmin\n" + - "aaiClientConnectionTimeout=30000\n" + - "\n" + - "[pm]\n" + - "pmCluster=sendateodl5\n" + - "pmEnabled=true\n" + - "\n" + - ""; - private HttpServer server; - private ExecutorService httpThreadPool; - private ConfigurationFileRepresentation globalCfg; - - @Test - public void test() { - - String testConfigurationFileName = ResourceFileLoader.getFile(this, CONFIGURATIONTESTFILE).getAbsolutePath(); - ConfigurationFileRepresentation cfg=new ConfigurationFileRepresentation(testConfigurationFileName); - - AaiProviderClient provider = new AaiProviderClient(cfg, null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List<String> ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - InventoryInformation ii=new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName,ii); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); - System.out.println("finished"); - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Test - public void test2() { - try { - Thread.sleep(3000); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - AaiProviderClient provider = new AaiProviderClient(globalCfg, null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List<String> ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - InventoryInformation ii=new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName); - provider.onDeviceRegistered(mountPointName,ii); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); - System.out.println("finished"); - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Before - public void initAaiTestWebserver() throws IOException { - try { - Files.asCharSink(ENABLEDAAI_TESTCONFIG_FILE, StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - } catch (IOException e1) { - fail(e1.getMessage()); - } - //globalCfg=HtDevicemanagerConfiguration.getTestConfiguration(ENABLEDAAI_TESTCONFIG_FILENAME,true); - globalCfg = new ConfigurationFileRepresentation(ENABLEDAAI_TESTCONFIG_FILENAME); - this.server = HttpServer.create(new InetSocketAddress(AAI_SERVER_PORT), 0); - this.httpThreadPool = Executors.newFixedThreadPool(5); - this.server.setExecutor(this.httpThreadPool); - AaiConfig config = new AaiConfig(globalCfg); - this.server.createContext(config.getBaseUri(), new MyHandler()); - //server.createContext("/", new MyRootHandler()); - this.server.setExecutor(null); // creates a default executor - this.server.start(); - System.out.println("http server started"); - } - - @After - public void stopTestWebserver() { - if (this.server != null) { - this.server.stop(0); - this.httpThreadPool.shutdownNow(); - System.out.println("http server stopped" ); - } - if (ENABLEDAAI_TESTCONFIG_FILE.exists()) { - ENABLEDAAI_TESTCONFIG_FILE.delete(); - } - - } - static class MyHandler implements HttpHandler { - @Override - public void handle(HttpExchange t) throws IOException { - String method = t.getRequestMethod(); - System.out.println("req method: " + method); - OutputStream os = null; - try { - String res=""; - if (method.equals("GET")) { - t.sendResponseHeaders(404,res.length() ); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else if (method.equals("DELETE")) { - t.sendResponseHeaders(200, res.length()); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else if (method.equals("PUT")) { - t.sendResponseHeaders(200, res.length()); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else { - t.sendResponseHeaders(404, 0); - } - System.out.println("req handled successful"); - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - finally { - if (os != null) - { - os.close(); - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java deleted file mode 100644 index 7bc30550f..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.fail; -import java.io.File; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.conf.odlAkka.AkkaConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.conf.odlAkka.ClusterNodeInfo; - -public class TestAkkaConfig { - - private static String getAkkaConfigSingleNodeText() { - return "\n" + "odl-cluster-data {\n" + " akka {\n" + " remote {\n" + " artery {\n" - + " enabled = off\n" + " canonical.hostname = \"127.0.0.1\"\n" - + " canonical.port = 2550\n" + " }\n" + " netty.tcp {\n" - + " hostname = \"127.0.0.1\"\n" + " port = 2550\n" + " }\n" - + " # when under load we might trip a false positive on the failure detector\n" - + " # transport-failure-detector {\n" + " # heartbeat-interval = 4 s\n" - + " # acceptable-heartbeat-pause = 16s\n" + " # }\n" + " }\n" + "\n" + " cluster {\n" - + " # Remove \".tcp\" when using artery.\n" - + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n" + "\n" - + " roles = [\n" + " \"member-1\"\n" + " ]\n" + "\n" + " }\n" + "\n" - + " persistence {\n" - + " # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by\n" - + " # modifying the following two properties. The directory location specified may be a relative or absolute path. \n" - + " # The relative path is always relative to KARAF_HOME.\n" + "\n" - + " # snapshot-store.local.dir = \"target/snapshots\"\n" - + " # journal.leveldb.dir = \"target/journal\"\n" + "\n" + " journal {\n" - + " leveldb {\n" + " # Set native = off to use a Java-only implementation of leveldb.\n" - + " # Note that the Java-only version is not currently considered by Akka to be production quality.\n" - + "\n" + " # native = off\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}"; - } - - private static String getAkkaConfigClusterNodeText() { - return "\n" + "odl-cluster-data {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n" - + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" - + " port = 2550\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n" - + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n" - + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n" - + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2550\"]\n" - + " seed-node-timeout = 15s\n" + " roles = [\"member-1\"]\n" + "\n" + " }\n" - + " persistence {\n" + " journal-plugin-fallback {\n" + " circuit-breaker {\n" - + " max-failures = 10\n" + " call-timeout = 60s\n" - + " reset-timeout = 30s\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}\n" + "\n" - + "odl-cluster-rpc {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n" - + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" - + " port = 2551\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n" - + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n" - + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n" - + " seed-nodes = [\"akka.tcp://odl-cluster-rpc@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2551\"]\n" - + " seed-node-timeout = 15s\n" + " }\n" + " persistence {\n" - + " journal-plugin-fallback {\n" + " circuit-breaker {\n" + " max-failures = 10\n" - + " call-timeout = 60s\n" + " reset-timeout = 30s\n" + " }\n" + " }\n" - + " }\n" + " }\n" + "}\n" + "\n" + ""; - } - - @Test - public void test1() { - AkkaConfig cfg; - try { - System.out.println("testing clusternode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.parse(getAkkaConfigClusterNodeText()); - System.out.println("succeeded: "); - System.out.println(cfg.toString()); - System.out.println(String.format("found %d cluster nodes", cfg.getClusterConfig().getSeedNodes().size())); - for (ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes()) { - System.out.println(n.toString()); - } - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } - - @Test - public void test2() { - AkkaConfig cfg; - try { - System.out.println("testing singlenode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.parse(getAkkaConfigSingleNodeText()); - System.out.println("succeeded: "); - System.out.println(cfg.toString()); - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } - - @Test - public void test3() { - AkkaConfig cfg; - - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource("captured-akka.conf").getFile()); - System.out.println(file.getAbsolutePath()); - - try { - System.out.println("testing clusternode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.load(file.getAbsolutePath()); - System.out.println("succeeded: "+cfg.hashCode()); - System.out.println(cfg.toString()); - System.out.println(String.format("found %d cluster nodes", cfg.getClusterConfig().getSeedNodes().size())); - for (ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes()) { - System.out.println(n.toString()); - } - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestConfiguration.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestConfiguration.java deleted file mode 100644 index 596196faa..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestConfiguration.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import java.io.File; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.exception.ConfigurationException; -import org.onap.ccsdk.features.sdnr.wt.database.config.EsConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ResourceFileLoader; - -public class TestConfiguration { - - private static final String CONFIGURATIONTESTFILE = "test.properties"; // for - - @Test - public void test1() throws ConfigurationException { - - System.out.println("Configuration file " + CONFIGURATIONTESTFILE); - - File testConfigurationFile = ResourceFileLoader.getFile(this, CONFIGURATIONTESTFILE); - System.out.println("Located at: "+testConfigurationFile.getAbsolutePath()); - - ConfigurationFileRepresentation configuration = new ConfigurationFileRepresentation(testConfigurationFile); - - System.out.println("Configuration: " + configuration.getSection(EsConfig.SECTION_MARKER_ES)); - EsConfig esConfig1 = new EsConfig(configuration); - - System.out.println("ES config getArchiveLifetimeSeconds: "+esConfig1.getArchiveLifetimeSeconds()); - - - // fail("Not yet implemented"); - } - - @Test - public void test2() { - - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDatabaseClient.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDatabaseClient.java deleted file mode 100644 index faea46180..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDatabaseClient.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.IOException; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.database.ExtRestClient; -import org.onap.ccsdk.features.sdnr.wt.common.database.InvalidProtocolException; -import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo.Protocol; -import org.onap.ccsdk.features.sdnr.wt.common.database.requests.CreateIndexRequest; -import org.onap.ccsdk.features.sdnr.wt.common.database.requests.GetIndexRequest; -import org.onap.ccsdk.features.sdnr.wt.common.database.requests.IndexRequest; -import org.onap.ccsdk.features.sdnr.wt.common.database.responses.CreateIndexResponse; -import org.onap.ccsdk.features.sdnr.wt.common.database.responses.IndexResponse; - -public class TestDatabaseClient { - - - private static ExtRestClient client; - - @BeforeClass - public static void init() throws InvalidProtocolException { - - client = ExtRestClient.createInstance("localhost",9200,Protocol.HTTP); - - } - @AfterClass - public static void deinit() { - try { - client.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - @Ignore - @Test - public void testIndexExists() { - - GetIndexRequest request =new GetIndexRequest("mwtn"); - try { - boolean response = client.indicesExists(request); - assertTrue(response); - } catch (IOException e) { - fail(e.getMessage()); - } - request =new GetIndexRequest("mwrn"); - try { - boolean response = client.indicesExists(request); - assertFalse(response); - } catch (IOException e) { - fail(e.getMessage()); - } - - } - @Ignore - @Test - public void testIndexCreate() { - CreateIndexRequest request = new CreateIndexRequest("mwtn"); - try { - CreateIndexResponse response = client.createIndex(request); - assertTrue(response.isAcknowledged()); - } catch (IOException e) { - fail(e.getMessage()); - } - } - @Ignore - @Test - public void testAddPmEntry() { - String json="{\"node-name\":\"sim12600\",\"uuid-interface\":\"LP-MWPS-TTP-01\",\"layer-protocol-name\":\"MWPS\",\"radio-signal-id\":\"Test11\",\"time-stamp\":\"2017-07-04T00:00:00.0Z\",\"granularity-period\":\"PERIOD_24HOURS\",\"scanner-id\":\"PM_RADIO_24H_1\",\"performance-data\":{\"rx-level-avg\":-41,\"time2-states\":-1,\"time4-states-s\":9,\"time4-states\":0,\"time8-states\":0,\"time16-states-s\":-1,\"time16-states\":0,\"time32-states\":1,\"time64-states\":1,\"time128-states\":2,\"time256-states\":38319,\"time512-states\":-1,\"time512-states-l\":-1,\"time1024-states\":-1,\"time1024-states-l\":-1,\"time2048-states\":-1,\"time2048-states-l\":-1,\"time4096-states\":-1,\"time4096-states-l\":-1,\"time8192-states\":-1,\"time8192-states-l\":-1,\"snir-min\":-99,\"unavailability\":504,\"tx-level-max\":25,\"tx-level-avg\":25,\"rx-level-min\":-41,\"rx-level-max\":-41,\"ses\":2,\"tx-level-min\":20,\"snir-max\":-99,\"snir-avg\":-99,\"xpd-min\":-99,\"xpd-max\":-99,\"xpd-avg\":-99,\"rf-temp-min\":-99,\"rf-temp-max\":-99,\"rf-temp-avg\":-99,\"defect-blocks-sum\":-1,\"time-period\":86400,\"cses\":0,\"es\":5},\"suspect-interval-flag\":true}"; - IndexRequest request=new IndexRequest("historicalperformance24h", "historicalperformance24h","sim12600/LP-MWPS-TTP-01/2017-07-04T00:00:00.0+00:00"); - request.source(json); - try { - IndexResponse response = client.index(request); - - assertTrue(response.isCreated() || response.isUpdated()); - } catch (IOException e) { - e.printStackTrace(); - fail(e.getMessage()); - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java deleted file mode 100644 index 2b8f4b890..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.legacy.InventoryInformation; -import com.google.common.io.Files; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; - -@SuppressWarnings("restriction") -public class TestDcae { - - private static final String ENABLEDDCAE_TESTCONFIG_FILENAME = "test2.properties"; - private static final File ENABLEDDCAE_TESTCONFIG_FILE = new File(ENABLEDDCAE_TESTCONFIG_FILENAME); - private static final int DCAE_SERVER_PORT=45451; - private static final String URI = "/abc"; - private static final String TESTCONFIG_CONTENT="[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:"+DCAE_SERVER_PORT+URI+"\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\n" + - "aaiTrustAllCerts=false\n" + - "aaiApiVersion=aai/v13\n" + - "aaiPropertiesFile=aaiclient.properties\n" + - "aaiApplicationId=SDNR\n" + - "aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12\n" + - "aaiPcks12ClientCertPassphrase=adminadmin\n" + - "aaiClientConnectionTimeout=30000\n" + - "\n" + - "[pm]\n" + - "pmCluster=sendateodl5\n" + - "pmEnabled=true\n" + - "\n" + - ""; - private HttpServer server; - private ExecutorService httpThreadPool; - private ConfigurationFileRepresentation cfg; - - @Test - public void test2() { - try { - Thread.sleep(3000); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - DcaeProviderClient provider = new DcaeProviderClient(cfg,"mountpoint",null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List<String> ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - boolean neDeviceAlarm = false; - ProblemNotificationXml notification = new ProblemNotificationXml(mountPointName, "network-element", "problemName", InternalSeverity.Critical,123, InternalDateAndTime.getTestpattern()); - provider.sendProblemNotification(mountPointName, notification, neDeviceAlarm); - - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Before - public void initDcaeTestWebserver() throws IOException { - try { - Files.asCharSink(ENABLEDDCAE_TESTCONFIG_FILE, StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - } catch (IOException e1) { - fail(e1.getMessage()); - } - cfg = new ConfigurationFileRepresentation(ENABLEDDCAE_TESTCONFIG_FILENAME); - // cfg.reload(ENABLEDDCAE_TESTCONFIG_FILENAME); - /* - * cfg = new HtDevicemanagerConfiguration(ENABLEDDCAE_TESTCONFIG_FILENAME); - * DcaeConfig.reload(); - */ - try { - this.server = HttpServer.create(new InetSocketAddress(DCAE_SERVER_PORT), 0); - } catch (Exception e) { - fail(e.getMessage()); - } - this.httpThreadPool = Executors.newFixedThreadPool(5); - this.server.setExecutor(this.httpThreadPool); - this.server.createContext(URI, new MyHandler()); - // server.createContext("/", new MyRootHandler()); - this.server.setExecutor(null); // creates a default executor - this.server.start(); - System.out.println("http server started"); - } - - @After - public void stopTestWebserver() { - if (this.server != null) { - this.server.stop(0); - this.httpThreadPool.shutdownNow(); - System.out.println("http server stopped"); - } - if (ENABLEDDCAE_TESTCONFIG_FILE.exists()) { - ENABLEDDCAE_TESTCONFIG_FILE.delete(); - } - } - - static class MyHandler implements HttpHandler { - @Override - public void handle(HttpExchange t) throws IOException { - String method = t.getRequestMethod(); - System.out.println("req method: " + method); - OutputStream os = null; - try { - String res = ""; - if (method.equals("POST")) { - t.sendResponseHeaders(200, res.length()); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else { - t.sendResponseHeaders(404, 0); - } - System.out.println("req handled successful"); - - } catch (Exception e) { - System.out.println(e.getMessage()); - } finally { - if (os != null) { - os.close(); - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java deleted file mode 100644 index 3fe4f1abf..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.database.config.EsConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.config.AaiConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.config.DcaeConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.config.PmConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.conf.ToggleAlarmConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.io.Files; - -public class TestDevMgrPropertiesFile { - - private static final Logger LOG = LoggerFactory.getLogger(ArchiveCleanService.class); - - private static final File FILENAME = new File("test.properties"); - private static final File AAIPROP_FILE=new File("aaiclient.properties"); - private int hasChanged; - - @Before - public void init() { - //if (! LOG.isDebugEnabled()) { - delete(FILENAME); - delete(AAIPROP_FILE); - //} - } - @After - public void deinit() { - this.init(); - } - - @Test - public void test1() { - - writeFile(FILENAME, this.getContent1()); - writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - - System.out.println("Read and verify"); - ConfigurationFileRepresentation cfg = new ConfigurationFileRepresentation(FILENAME.getPath()); - ConfigurationFileRepresentation cfg2 = cfg; - - AaiConfig aaiConfig = new AaiConfig(cfg2); - assertNotNull(aaiConfig); - DcaeConfig dcaeConfig = new DcaeConfig(cfg2); - assertNotNull(dcaeConfig); - PmConfig pmConfig = new PmConfig(cfg2); - assertNotNull(pmConfig); - EsConfig esConfig = new EsConfig(cfg2); - assertNotNull(esConfig); - ToggleAlarmConfig toggleAlarmConfig = new ToggleAlarmConfig(cfg2); - assertNotNull(toggleAlarmConfig); - - System.out.println("Verify\n"+aaiConfig+"\n"); - @SuppressWarnings("unused") - boolean res; - /* - res = cfg.getAai().equals(AaiConfig.getDefaultConfiguration()); - res = cfg.getDcae().equals(DcaeConfig.getDefaultConfiguration()); - res = cfg.getPm().equals(PmConfig.getDefaultConfiguration()); - res = cfg.getEs().equals(EsConfig.getDefaultConfiguration()); - res = cfg.getToggleAlarm().equals(ToggleAlarmConfig.getDefaultConfiguration()); - - res = cfg.getAai().hashCode() == AaiConfig.getDefaultConfiguration().hashCode(); - res = cfg.getDcae().hashCode() == DcaeConfig.getDefaultConfiguration().hashCode(); - res = cfg.getPm().hashCode() == PmConfig.getDefaultConfiguration().hashCode(); - res = cfg.getEs().hashCode() == EsConfig.getDefaultConfiguration().hashCode(); - res = cfg.getToggleAlarm().hashCode() == ToggleAlarmConfig.getDefaultConfiguration().hashCode(); - */ - } - - //-- Observer not working with all testcases, because config does not support different file types. - @Test - public void test2() { - - hasChanged=0; - writeFile(FILENAME, this.getContent1()); - writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - - System.out.println("Read and verify"); - ConfigurationFileRepresentation cfg2 = new ConfigurationFileRepresentation(FILENAME.getPath()); - - AaiConfig aaiConfig = new AaiConfig(cfg2); - assertNotNull(aaiConfig); - DcaeConfig dcaeConfig = new DcaeConfig(cfg2); - assertNotNull(dcaeConfig); - PmConfig pmConfig = new PmConfig(cfg2); - assertNotNull(pmConfig); - EsConfig esConfig = new EsConfig(cfg2); - assertNotNull(esConfig); - ToggleAlarmConfig toggleAlarmConfig = new ToggleAlarmConfig(cfg2); - assertNotNull(toggleAlarmConfig); - - cfg2.registerConfigChangedListener(() -> { - hasChanged++; - System.out.println("file changed listener triggered: "+hasChanged); - }); - - sleep(1000); - System.out.println("Write new content. Changes "+hasChanged); - writeFile(FILENAME, this.getContent2()); - sleep(1000); - - int i=10; - while(hasChanged == 0 && i-- > 0) { - System.out.println("Wait for Change indication."); - sleep(1000); - } - System.out.println("Changes "+hasChanged); - - assertTrue("fileChanged counter"+hasChanged, hasChanged > 0); - System.out.println("Test done"); - - } - - - private static void sleep(int milliseconds) { - try { - Thread.sleep(milliseconds); - } catch (InterruptedException e) { - } - } - - public static void writeFile(File f, String content) { - try { - Files.asCharSink(f, StandardCharsets.UTF_8).write(content); - } catch (IOException e) { - fail(e.getMessage()); - }; - sleep(500); - } - - private void delete(File f) { - if(f.exists()) { - f.delete(); - } - } - - - private String getContent2() { - return "[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:45451/abc\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\n" + - "aaiTrustAllCerts=false\n" + - "aaiApiVersion=aai/v13\n" + - "aaiPropertiesFile=aaiclient.properties\n" + - "aaiApplicationId=SDNR\n" + - "aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12\n" + - "aaiPcks12ClientCertPassphrase=adminadmin\n" + - "aaiClientConnectionTimeout=30000\n" + - "\n" + - "[pm]\n" + - "pmCluster=sendateodl5\n" + - "pmEnabled=true\n" + - "[toggleAlarmFilter]\n" + - "taEnabled=true\n" + - "taDelay=5555\n" + - ""; - } - - private String getContent1() { - return "[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:45/abc\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\n" + - "aaiTrustAllCerts=false\n" + - "aaiApiVersion=aai/v13\n" + - "aaiPropertiesFile=aaiclient.properties\n" + - "\n" + - "[pm]\n" + - "pmCluster=sendateodl5\n" + - "pmEnabled=true\n" + - "[toggleAlarmFilter]\n" + - "taEnabled=false\n" + - "taDelay=5555\n" + - ""; - } - private String getAaiPropertiesConfig() { - return "org.onap.ccsdk.sli.adaptors.aai.ssl.key=keykey\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=psswdpsswd\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=\"false\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.application=appxyz\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.uri=uriu\"\"\n" + - "connection.timeout=60000\n" + - "read.timeout=60000"; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java deleted file mode 100644 index d9561e484..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java +++ /dev/null @@ -1,407 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.common.ResourcesFromDeviceManager; -import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; -import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; -import org.onap.ccsdk.features.sdnr.wt.database.config.EsConfig; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.NetconfNodeService.Action; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.ClusterSingletonServiceProviderMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.DataBrokerNetconfMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.DataProviderMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointServiceMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.NotificationPublishServiceMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.RpcProviderRegistryMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211Mock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211pMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint12Mock; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; -import org.opendaylight.mdsal.binding.api.MountPointService; -import org.opendaylight.mdsal.binding.api.NotificationPublishService; -import org.opendaylight.mdsal.binding.api.RpcProviderService; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestDeviceManagerWithDatabase { - - private static Path KARAF_ETC = Paths.get("etc"); - private static DeviceManagerImpl deviceManager; - private static MountPointMock mountPoint; - private static DataBrokerNetconfMock dataBrokerNetconf; - private static IEntityDataProvider dataProvider = new IEntityDataProvider() { - - @Override - public void setReadyStatus(boolean status) { - - } - - @Override - public DataProvider getDataProvider() { - return new DataProviderMock(); - } - }; - private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerWithDatabase.class); - - @BeforeClass - public static void before() throws InterruptedException, IOException { - - System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); - // Call System property to get the classpath value - Path etc = KARAF_ETC; - delete(etc); - - System.out.println("Create empty:" + etc.toString()); - Files.createDirectories(etc); - //write db config for testing - ConfigurationFileRepresentation configfile = new ConfigurationFileRepresentation(etc.resolve("devicemanager.properties").toFile()); - EsConfig dbConfig = new EsConfig(configfile); - dbConfig.setHosts(new HostInfo[] {new HostInfo("localhost",Integer.valueOf(System.getProperty("databaseport")!=null?System.getProperty("databaseport"):"49200")) }); - - configfile.save(); - // Create mocks - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf = new DataBrokerNetconfMock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint = new MountPointMock(); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock(); - MountPointService mountPointService = new MountPointServiceMock(mountPoint); - NotificationPublishService notificationPublishService = new NotificationPublishServiceMock(); - RpcProviderService rpcProviderRegistry = new RpcProviderRegistryMock(); - - // start using blueprint interface - String msg = ""; - try { - deviceManager = new DeviceManagerImpl(); - - deviceManager.setDataBroker(dataBrokerNetconf); - deviceManager.setMountPointService(mountPointService); - deviceManager.setNotificationPublishService(notificationPublishService); - deviceManager.setRpcProviderRegistry(rpcProviderRegistry); - deviceManager.setClusterSingletonService(clusterSingletonService); - deviceManager.setEntityDataProvider(dataProvider); - deviceManager.init(); - } catch (Exception e) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - e.printStackTrace(pw); - msg = sw.toString(); // stack trace as a string - e.printStackTrace(); - } - readOnlyTransaction.close(); - System.out.println("Initialization status: " + deviceManager.isDevicemanagerInitializationOk()); - assertTrue("Devicemanager not initialized: " + msg, deviceManager.isDevicemanagerInitializationOk()); - System.out.println("Initialization done"); - waitfordatabase(); - } - - @AfterClass - public static void after() throws InterruptedException, IOException { - - System.out.println("Start shutdown"); - // close using blueprint interface - try { - deviceManager.close(); - } catch (Exception e) { - System.out.println(e); - } - delete(KARAF_ETC); - - } - - @Test - public void test2() { - System.out.println("Test2: slave mountpoint"); - - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - - mountPoint.setDatabrokerAbsent(true); - NodeId nodeId = new NodeId("mountpointTest2"); - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - - readOnlyTransaction.close(); - System.out.println("Test2: Done"); - - } - - @Test - public void test3() { - System.out.println("Test3: master mountpoint ONF Model 12"); - - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest3"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - System.out.println("Devicemanager started ----"); - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - - readOnlyTransaction.close(); - System.out.println("Test3: Done"); - - } - - @Test - public void test4() { - System.out.println("Test4: master mountpoint ONF Model 1211"); - - ReadOnlyTransactionMountpoint1211Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint1211Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest4"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - Thread.interrupted(); - } - - readOnlyTransaction.close(); - System.out.println("Test4: Done"); - - } - - @Test - public void test5() { - System.out.println("Test5: master mountpoint ONF Model 1211p"); - - ReadOnlyTransactionMountpoint1211pMock readOnlyTransaction = new ReadOnlyTransactionMountpoint1211pMock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest5"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - Thread.interrupted(); - } - - readOnlyTransaction.close(); - System.out.println("Test5: Done"); - - } - - @Test - public void test6() { - - System.out.println("Test6: Write zip data file file"); - File testFile = new File("etc/elasticsearch_update.zip"); - ResourcesFromDeviceManager.extractFileTo("elasticsearch_update.zip", testFile); - int wait = 130; - while (testFile.exists() && wait-- > 0) { - System.out.println("Waiting " + wait); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.interrupted(); - } - } - - - System.out.println("Test6: Done"); - - } - - /* - @Test - public void test7() throws Exception { - final int NUM = 5; - final int ARCHIVE_DAYS = 30; - final long ARCHIVE_LIMIT_SEC = TimeUnit.SECONDS.convert(ARCHIVE_DAYS, TimeUnit.DAYS); - final long ARCHIVE_INTERVAL_SEC = 10; - File propFile = KARAF_ETC.resolve("devicemanager.properties").toFile(); - - ArchiveCleanService service = deviceManager.getArchiveCleanService(); - DBCleanServiceHelper helper = new DBCleanServiceHelper(deviceManager); - - // setEsConfg - TestDevMgrPropertiesFile.writeFile(propFile, getContent(ARCHIVE_LIMIT_SEC, ARCHIVE_INTERVAL_SEC)); - //give time to read file - sleep(5); - System.out.println("Archive clean service configuration "+service); - System.out.println("To delete elements older: "+service.getDateForOldElements()); - System.out.println("Status of elements is: "+service.countOldEntries()); - - // create old data and check if the will be cleaned completely - int elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0 ); //Hours - System.out.println("Written elements are: "+elements); - - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Entries are not cleared completely as expected"); - - // create partial old and newer data and check that only half of all data are cleaned - // New data are not counted as "old" .. - int elementsToRemove = elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0); - elements += helper.writeDataToLogs(NUM, ARCHIVE_DAYS-5, 0); - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elementsToRemove, "Entries are not cleared exactly half as expected"); - - // create only newer data and check that nothing is cleaned - elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+2, 0); - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Some entries were removed, but shouldn't."); - - service.close(); - } -*/ - // ********************* Private - - @SuppressWarnings("unused") - private void waitForDeletion(ArchiveCleanService service, long timeout, long numberAtBeginning, String faultMessage) { - int numberEntries = 0; - while (timeout-- > 0) { - sleep(1000); - numberEntries = service.countOldEntries(); - if (numberEntries <= 0) { - break; - } - } - if (timeout == 0) { - fail(faultMessage + " Timeout at:" + timeout + " Entries at beginning " + numberAtBeginning - + " remaining" + numberEntries); - } - } - - - private static void waitfordatabase() throws InterruptedException { -/* - System.out.println("Test1: Wait for database"); - int timeout = DATABASETIMEOUTSECONDS; - while (!deviceManager.isDatabaseInitializationFinished() && timeout-- > 0) { - System.out.println("Test1: " + timeout); - Thread.sleep(1000); // On second - } - System.out.println("Ddatabase initialized"); -*/ - } - - private static void sleep(int millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException e) { - LOG.warn(e.getMessage()); - Thread.interrupted(); - } - } - - private static void delete(Path etc) throws IOException { - if (Files.exists(etc)) { - System.out.println("Found and remove:" + etc.toString()); - delete(etc.toFile()); - } - } - - private static void delete(File f) throws IOException { - if (f.isDirectory()) { - for (File c : f.listFiles()) { - delete(c); - } - } - if (!f.delete()) { - throw new FileNotFoundException("Failed to delete file: " + f); - } - } - - @SuppressWarnings("unused") - private String getContent(long archiveLimitSeconds, long esArchiveCheckIntervalSeconds) { - return "[dcae]\n" + "dcaeUserCredentials=admin:admin\n" + "dcaeUrl=http://localhost:45/abc\n" - + "dcaeHeartbeatPeriodSeconds=120\n" + "dcaeTestCollector=no\n" + "\n" + "[aots]\n" - + "userPassword=passwd\n" + "soapurladd=off\n" + "soapaddtimeout=10\n" + "soapinqtimeout=20\n" - + "userName=user\n" + "inqtemplate=inqreq.tmpl.xml\n" + "assignedto=userid\n" - + "addtemplate=addreq.tmpl.xml\n" + "severitypassthrough=critical,major,minor,warning\n" - + "systemuser=user\n" + "prt-offset=1200\n" + "soapurlinq=off\n" + "#smtpHost=\n" + "#smtpPort=\n" - + "#smtpUsername=\n" + "#smtpPassword=\n" + "#smtpSender=\n" + "#smtpReceivers=\n" + "\n" + "[es]\n" - + "esCluster=sendateodl5\n" + "esArchiveLifetimeSeconds=" + archiveLimitSeconds + "\n" + "esArchiveCheckIntervalSeconds=" - + esArchiveCheckIntervalSeconds + "\n" + "\n" + "[aai]\n" + "#keep comment\n" - + "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + "aaiUrl=off\n" + "aaiUserCredentials=AAI:AAI\n" - + "aaiDeleteOnMountpointRemove=true\n" + "aaiTrustAllCerts=false\n" + "aaiApiVersion=aai/v13\n" - + "aaiPropertiesFile=aaiclient.properties\n" + "\n" + "[pm]\n" + "pmCluster=sendateodl5\n" - + "pmEnabled=true\n" + "[toggleAlarmFilter]\n" + "taEnabled=false\n" + "taDelay=5555\n" + ""; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java deleted file mode 100644 index f48395648..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.mockito.Mockito; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ExtendedEquipment; -import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsMapper; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderKey; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.ExtensionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryEntity; - -import com.fasterxml.jackson.core.JsonProcessingException; - -public class TestEquipment extends Mockito { - - YangToolsMapper yangtoolsMapper = new YangToolsMapper(); - - @Test - public void test1() { - - ExtendedEquipment extendedEquipment = getTestEquipment(1); - String extendedEquipmentString = extendedEquipment.toString(); - System.out.println(extendedEquipmentString); - } - - @Test - public void test2() { - - List<ExtendedEquipment> equipmentList = new ArrayList<>(); - equipmentList.add(getTestEquipment(2)); - equipmentList.add(getTestEquipment(3)); - - InventoryEntity esEquipment; - for (ExtendedEquipment equipment1 : equipmentList) { - esEquipment = equipment1.getCreateInventoryInput(); - try { - String json = yangtoolsMapper.writeValueAsString(esEquipment); - System.out.println("JSON: "+json); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - // eventRWEquipment.write(esEquipment,equipment1.getNodeId()+"/"+equipment1.getParentUuid()); - } - } - - private ExtendedEquipment getTestEquipment(int number) { - // Move to InventoryEntity - EquipmentBuilder equipmentBuilder = new EquipmentBuilder(); - equipmentBuilder.setUuid(new UniversalId("EquipmentId")); - ContainedHolderBuilder containedHolderBuilder = new ContainedHolderBuilder(); - List<Extension> xy = new ArrayList<>(); - xy.add(new ExtensionBuilder().setValueName("Test1").setValue("TestValue").build()); - containedHolderBuilder.setExtension(xy); - containedHolderBuilder.withKey(new ContainedHolderKey(new UniversalId("MyKey" + number))); - List<ContainedHolder> z = new ArrayList<>(); - z.add(containedHolderBuilder.build()); - equipmentBuilder.setContainedHolder(z); - - ExtendedEquipment extendedEquipment = new ExtendedEquipment("node" + number, "Parent", equipmentBuilder.build(), - "X/" + number, number); - return extendedEquipment; - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java deleted file mode 100644 index 6474a1eb6..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.conf.odlGeo.GeoConfig; - -public class TestGeoConfig { - - @Test - public void test() { - GeoConfig config; - try { - System.out.println("testing clusternode geo config1"); - System.out.println("==========================="); - config = GeoConfig.parse(getClusterGeoConfigContent()); - System.out.println("succeeded: "); - System.out.println(config.toString()); - System.out.println("primary roles:"); - System.out.println(config.getPrimaryRoles().toString()); - System.out.println("secondary roles:"); - System.out.println(config.getSecondaryRoles().toString()); - - } catch (Exception e) { - fail("failed: " + e.getMessage()); - } - } - - - - private static String getClusterGeoConfigContent() { - return "\n" + "lumina-geo-cluster {\n" + " primary_roles = [\n" - + " \"member-1\",\"member-2\",\"member-3\"\n" + " ]\n" + " secondary_roles = [\n" - + " \"member-4\",\"member-5\",\"member-6\"\n" + " ]\n" + " ip_roles_table = [\n" + "\n" - + " {\n" + "role=\"member-1\"\n" + "ip=\"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" + "},\n" - + "{\n" + "role=\"member-2\"\n" + "ip=\"zltcmtn23arbc02.2f0377.mtn23a.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-3\"\n" + "ip=\"zltcmtn23arbc03.2f0377.mtn23a.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-4\"\n" + "ip=\"zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-5\"\n" + "ip=\"zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-6\"\n" + "ip=\"zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com\"\n" + "}\n" + " \n" - + " ]\n" + "}\n" + "\n" + "\n" + "\n" + "\n" + ""; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java deleted file mode 100644 index 932ad52d2..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import java.time.ZonedDateTime; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.impl.MaintenanceCalculator; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; - -public class TestMaintenanceTimeFilter { - - private static String DEFAULT1 = "EsMaintenanceFilter [start=1970-01-01T00:00Z[UTC], end=1970-01-01T00:00Z[UTC], definition=EsMaintenanceFilterDefinition [objectIdRef=, problem=], description=]"; - private static String DEFAULT2 = "EsMaintenanceFilter [start=1970-01-01T00:00Z[UTC], end=2018-01-01T10:00+05:00, definition=EsMaintenanceFilterDefinition [objectIdRef=, problem=], description=]"; - - @Test - public void test1() { - - boolean res; - - DateAndTime start = new DateAndTime("2018-01-01T10:00:00+05:00"); - DateAndTime end = new DateAndTime("2019-01-01T10:00:00+05:00"); - ZonedDateTime now; - - now = ZonedDateTime.parse("2017-05-01T10:00:00+05:00"); - res = MaintenanceCalculator.isInPeriod(start, end, now); - System.out.println("Before: " + res); - assertFalse("before period", res); - - now = ZonedDateTime.parse("2018-05-01T10:00:00+05:00"); - res = MaintenanceCalculator.isInPeriod(start, end, now); - System.out.println("Within: " + res); - assertTrue("within period",res); - - now = ZonedDateTime.parse("2019-05-01T10:00:00+05:00"); - res = MaintenanceCalculator.isInPeriod(start, end, now); - System.out.println("After: " + res); - assertFalse("after period", res); - - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java deleted file mode 100644 index 837784aec..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.HtMapper; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestMapper { - - @Test - public void test1() { - - int t = 0; - System.out.println(t++); - - HtMapper<EsHistoricalPerformance15Minutes> mapper = new HtMapper<>(EsHistoricalPerformance15Minutes.class); - System.out.println(t++); - - - Lp layerProtocol = new LpBuilder().setUuid(new UniversalId("TestId")) - .setLayerProtocolName(new LayerProtocolName("LayprotcolTest")).build(); - System.out.println(t++); - EsHistoricalPerformance15Minutes pmData = new EsHistoricalPerformance15Minutes("Testnode", layerProtocol); - System.out.println(t++); - - // AirInterfaceHistoricalPerformancesBuilder builder1 = new - // AirInterfaceHistoricalPerformancesBuilder(); - // System.out.println(t++); - - - HistoricalPerformanceDataListBuilder builder2 = new HistoricalPerformanceDataListBuilder(); - System.out.println(t++); - builder2.setPeriodEndTime(new DateAndTime("2019-06-06T12:12:12.1Z")); - System.out.println(t++); - - String json = mapper.objectToJson(pmData); - - System.out.println("Result: " + pmData); - System.out.println("Result: " + json); - - // fail("Not yet implemented"); - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNameSpace.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNameSpace.java deleted file mode 100644 index 4a85299d7..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNameSpace.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import org.junit.Test; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yangtools.yang.common.QName; - -public class TestNameSpace { - - @Test - public void test() { - - QName qname = QName.create("(urn:o-ran:hardware:1.0?revision=2019-03-28)o-ran-hardware"); - - System.out.println("QName getNamespace"+qname.getNamespace()); - System.out.println("QName getRevision"+qname.getRevision()); - - - System.out.println(NetworkElement.QNAME.getNamespace().toString()); - - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java deleted file mode 100644 index 7e54f16b1..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.toggleAlarmFilter.NotificationWithServerTimeStamp; - -public class TestNotification { - - @Test - public void test() { - - NotificationWithServerTimeStamp<Integer> test = new NotificationWithServerTimeStamp<>(1000); - - test.refresh(1000); - test.getStartTime(); - - System.out.println(test); - - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java deleted file mode 100644 index 0037724bf..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData12 { - - @Test - public void test1() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java deleted file mode 100644 index ffd460c3c..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211 { - - @Test - public void test() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java deleted file mode 100644 index 60706771e..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211Ethernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java deleted file mode 100644 index dff517de9..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211p { - - @Test - public void test() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java deleted file mode 100644 index 68cb5ca3d..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211pEthernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java deleted file mode 100644 index 96491af9f..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData12Ethernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestYangCloning.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestYangCloning.java deleted file mode 100644 index 363d84f3a..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestYangCloning.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import java.util.Arrays; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsCloner; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.AdministrativeState; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Faultcurrent; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultcurrentEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryEntity; - -public class TestYangCloning { - - @Test - public void testEquipment() { - EquipmentBuilder equipmentBuilder = new EquipmentBuilder(); - equipmentBuilder.setUuid( new UniversalId("EquipmentId")); - equipmentBuilder.setContainedHolder(Arrays.asList(new ContainedHolderBuilder() - .setUuid(new UniversalId("HolderId")) - .setAdministrativeState(AdministrativeState.Locked) - .setSupportedEquipment(Arrays.asList("eq1")) - .build())); - Equipment equipment = equipmentBuilder.build(); - InventoryEntity output = YangToolsCloner.instance().cloneToBuilder(equipment, new InventoryBuilder()) - .setNodeId("node1").setUuid("a.a.a").setId("node1"+"/"+"a.a.a").build(); - - - System.out.println("source:"); - System.out.println(equipment); - System.out.println("result:"); - System.out.println(output); - - - } - @Test - public void testFaultCurrent() { - ProblemNotificationXml source = new ProblemNotificationXml("node", "uuid", "problem", InternalSeverity.Critical,54,InternalDateAndTime.getTestpattern()); - FaultcurrentEntity output = YangToolsCloner.instance().clone(source,Faultcurrent.class); - - System.out.println("source:"); - System.out.println(source); - System.out.println("result:"); - System.out.println(output); - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java deleted file mode 100644 index 3108aa5ce..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.wrapperc.WrapperMicrowaveModelRev170324; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.Model12ObjectMock; -import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; - -public class TestsCapability { - - private static NetconfNode nNode; - - @BeforeClass - public static void before() { - nNode = new Model12ObjectMock().getNetconfNode(); - } - - @Test - public void test1() { - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - assertTrue(capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)); - - } - - @Test - public void test2() { - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - assertTrue(capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)); - - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java deleted file mode 100644 index fc01274c0..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.base.netconf.util.NetconfTimeStamp; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.NetconfTimeStampOld; - -public class TestsNectconfDateTime { - - private static String[] testPatterPostive = { - "2017-01-18T11:44:49.482-0500", - "2017-01-18T11:44:49.482-05:00", - "20170118114449.123Z", - "20170118114449.1Z", - "20170118114449.1-0500", - "2017-01-23T13:32:38-05:00", - "2017-01-23T13:32-05:00", - "2017-01-18T11:44:49Z" - }; - private static String[] testPatterProblem = { - "2017-01-18T11:44:49" - }; - - - private final NetconfTimeStampOld netconfTimeConverterOld = NetconfTimeStampOld.getConverter(); - private final NetconfTimeStamp netconfTimeConverterNew = NetconfTimeStamp.getConverter(); - - @Test - public void test1() { - - int t = 1; - String timeNew, timeOld; - for (String testTime : testPatterPostive) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconf(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconf(testTime); - - System.out.println("No "+t+++" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - - for (String testTime : testPatterProblem) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconf(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconf(testTime); - - System.out.println("No "+t+++" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - } - - @Test - public void test2() { - - int t = 1; - Long timeNew, timeOld; - for (String testTime : testPatterPostive) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconfAsMilliseconds(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconfAsMilliseconds(testTime); - - System.out.println("No "+t+++" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - - } - - - @Test - public void test3() { - - Date now = new Date(); - String timeNew = netconfTimeConverterNew.getTimeStampAsNetconfString(now); - String timeOld = netconfTimeConverterOld.getTimeStampAsNetconfString(now); - - System.out.println("Old/New: "+timeOld+"/"+timeNew); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - - - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java deleted file mode 100644 index a215e1883..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; - -public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { - - @Override - public void close() throws Exception { - - } - - @Override - public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java deleted file mode 100644 index 2bd5a9272..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.BindingService; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; -import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.binding.api.ReadWriteTransaction; -import org.opendaylight.mdsal.binding.api.TransactionChain; -import org.opendaylight.mdsal.binding.api.TransactionChainListener; -import org.opendaylight.mdsal.binding.api.WriteTransaction; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerMountpointMock implements DataBroker, BindingService { - - ReadTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public @NonNull ReadTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public @NonNull ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public @NonNull WriteTransaction newWriteOnlyTransaction() { - return null; - } - - @Override - public <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L> registerDataTreeChangeListener( - @NonNull DataTreeIdentifier<T> treeId, @NonNull L listener) { - return null; - } - - @Override - public @NonNull TransactionChain createTransactionChain(@NonNull TransactionChainListener listener) { - return null; - } - - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java deleted file mode 100644 index 0b5052632..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; -import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.binding.api.ReadWriteTransaction; -import org.opendaylight.mdsal.binding.api.TransactionChain; -import org.opendaylight.mdsal.binding.api.TransactionChainListener; -import org.opendaylight.mdsal.binding.api.WriteTransaction; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerNetconfMock implements DataBroker { - - - ReadTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public @NonNull ReadTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public @NonNull ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public @NonNull WriteTransaction newWriteOnlyTransaction() { - return null; - } - - @Override - public <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L> registerDataTreeChangeListener( - @NonNull DataTreeIdentifier<T> treeId, @NonNull L listener) { - return null; - } - - @Override - public @NonNull TransactionChain createTransactionChain(@NonNull TransactionChainListener listener) { - return null; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataProviderMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataProviderMock.java deleted file mode 100644 index 5fbef21f3..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataProviderMock.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019 Red Hat, 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.features.sdnr.wt.devicemanager.test.mock; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionlogEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultcurrentEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultlogEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Inventory; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionEntity; - -public class DataProviderMock implements DataProvider { - - @Override - public void writeConnectionLog(ConnectionlogEntity event) { - } - - @Override - public void writeEventLog(EventlogEntity event) { - } - - @Override - public void writeFaultLog(FaultlogEntity fault) { - } - - @Override - public void updateFaultCurrent(FaultcurrentEntity fault) { - } - - @Override - public int clearFaultsCurrentOfNode(String nodeName) { - return 0; - } - - @Override - public int clearFaultsCurrentOfNodeWithObjectId(String nodeName, String objectId) { - return 0; - } - - @Override - public List<String> getAllNodesWithCurrentAlarms() { - return new ArrayList<>(); - } - - @Override - public void writeInventory(Inventory internalEquipment) { - } - - @Override - public void updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy, - String nodeId) { - } - - @Override - public void updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy, - String nodeId) { - } - - @Override - public void removeNetworkConnection(String nodeId) { - } - - @Override - public int doIndexClean(Date olderAreOutdated) { - return 0; - } - - @Override - public int getNumberOfOldObjects(Date olderAreOutdated) { - return 0; - } - - @Override - public List<NetworkElementConnectionEntity> getNetworkElementConnections() { - return new ArrayList<>(); - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java deleted file mode 100644 index 73d32e418..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import java.util.Optional; -import org.opendaylight.mdsal.binding.api.BindingService; -import org.opendaylight.mdsal.binding.api.MountPoint; -import org.opendaylight.mdsal.binding.api.NotificationService; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointMock implements MountPoint { - - private boolean databrokerAbsent = true; - private final DataBrokerMountpointMock dataBroker = new DataBrokerMountpointMock(); - private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock(); - private NotificationService setReadOnlyTransaction; - - private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID = - InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, - new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))); - - @Override - public InstanceIdentifier<?> getIdentifier() { - return NETCONF_TOPO_IID; - } - - @SuppressWarnings("unchecked") - @Override - public <T extends BindingService> Optional<T> getService(Class<T> service) { - - System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent); - - Optional<?> res; - if (service.isInstance(dataBroker)) { - System.out.println("Delivering databroker"); - res = databrokerAbsent ? Optional.empty() : Optional.of(dataBroker); - } else if (service.isInstance(rpcConsumerRegistry)) { - System.out.println("Delivering RpcConsumerRegistryMock"); - res = Optional.of(rpcConsumerRegistry); - } else if (service.isInstance(setReadOnlyTransaction)) { - System.out.println("Delivering notificationService"); - res = Optional.of(setReadOnlyTransaction); - } else { - System.out.println("Delivering no service"); - res = Optional.empty(); - } - return (Optional<T>)res; - } - - public void setDatabrokerAbsent( boolean state) { - this.databrokerAbsent = state; - } - - public <T extends NotificationService&ReadTransaction>void setReadOnlyTransaction(T readOnlyTransaction) { - this.setReadOnlyTransaction = readOnlyTransaction; - dataBroker.setReadOnlyTransaction(readOnlyTransaction); - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java deleted file mode 100644 index 113ead29f..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import java.util.Optional; -import org.opendaylight.mdsal.binding.api.MountPoint; -import org.opendaylight.mdsal.binding.api.MountPointService; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -public class MountPointServiceMock implements MountPointService { - - private final MountPoint mountpoint; - - public MountPointServiceMock(MountPoint mountpoint) { - this.mountpoint = mountpoint; - } - - @Override - public Optional<MountPoint> getMountPoint(InstanceIdentifier<?> instanceId) { - - Optional<MountPoint> optional = Optional.of(mountpoint); - return optional; - } - - @Override - public <T extends MountPointListener> ListenerRegistration<T> registerListener(InstanceIdentifier<?> path, - T listener) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java deleted file mode 100644 index fc3318b9e..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.concurrent.TimeUnit; -import org.opendaylight.mdsal.binding.api.NotificationPublishService; -import org.opendaylight.yangtools.yang.binding.Notification; - -/** - * @author herbert - * - */ -public class NotificationPublishServiceMock implements NotificationPublishService { - - @Override - public ListenableFuture<?> offerNotification(Notification notification) { - return null; - } - - @Override - public ListenableFuture<?> offerNotification(Notification notification, int timeout, TimeUnit unit) - throws InterruptedException { - return null; - } - - @Override - public void putNotification(Notification notification) throws InterruptedException { - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java deleted file mode 100644 index 89864c2c5..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yangtools.yang.binding.RpcService; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class RpcConsumerRegistryMock implements RpcConsumerRegistry { - - @Override - public <T extends RpcService> T getRpcService(Class<T> serviceInterface) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java deleted file mode 100644 index 4aaa1ed48..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.mock; - -import java.util.Set; -import org.opendaylight.mdsal.binding.api.RpcProviderService; -import org.opendaylight.yangtools.concepts.ObjectRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.RpcService; - -public class RpcProviderRegistryMock implements RpcProviderService { - - @Override - public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type, - T implementation) { - System.out.println("Register class "+implementation); - return null; - } - - @Override - public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type, - T implementation, Set<InstanceIdentifier<?>> paths) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java deleted file mode 100644 index 2ac81ce46..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.util.Date; -import java.util.concurrent.TimeUnit; -import org.onap.ccsdk.features.sdnr.wt.base.netconf.util.NetconfTimeStamp; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SourceType; - -public class DBCleanServiceHelper { - - private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); - - private final DataProvider databaseEventService; - - /** - * Helper to fill data into the database - * @param deviceManager devicemanger to get services - */ - public DBCleanServiceHelper(DeviceManagerImpl deviceManager) { - this.databaseEventService = deviceManager.getDatabaseClientEvents(); - } - - /** - * Write data into database with specific date and content profile. - * @param number of data to be written for each log - * @param days starting day, relative to actual date - * @param hours starting hour ... increased by one hour for each write - * @return integer with the amount of written data - */ - public int writeDataToLogs(int number, int days, int hours) { - int res = 0; - for (Integer t=0; t < number; t++) { //Test "sdnevents", "eventlog" - ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml( - "Testpoint"+t, t, getInternalDateAndTime(days, hours+t), "ObjectId"+t); - databaseEventService.writeConnectionLog(notificationXml.getConnectionlogEntity()); - res++; - } - - for (Integer t=0; t < number; t++) { //Test "sdnevents", "faultlog" - ProblemNotificationXml fault = new ProblemNotificationXml( - "ProblemNode"+t, "Problemuuid", "Problemname", InternalSeverity.Major, t, getInternalDateAndTime(days, hours+t)); - databaseEventService.writeFaultLog(fault.getFaultlog(SourceType.Unknown)); - res++; - } - - return res; - } - - /************************************************************** - * Private section - */ - - private InternalDateAndTime getInternalDateAndTime(int days, int hours) { - Date actual = new Date(new Date().getTime() - TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS) - TimeUnit.MILLISECONDS.convert(hours, TimeUnit.HOURS)); - InternalDateAndTime timeStamp = InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp(actual)); - return timeStamp; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java deleted file mode 100644 index 124ac984a..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.wrapperc.WrapperMicrowaveModelRev180907; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model1211ObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev180907.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - nNodeBuilder.setHost(new Host(new IpAddress(new Ipv4Address("1.2.3.4")))); - nNodeBuilder.setPort(new PortNumber(2230)); - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // LTP/LP1 - /* - * LpBuilder lpBuilder1 = new LpBuilder(); lpBuilder1.withKey(new LpKey(new - * UniversalId("MwAirInterfacePacLpKey"))); lpBuilder1.setLayerProtocolName(new - * LayerProtocolName(ONFLayerProtocolName.MWAirInterface.getValue())); - * lpBuilder1.setExtension(Arrays.asList(getExtension("e1", "capability", - * MwAirInterfacePac.QNAME.getLocalName()), getExtension("e1", "revision", - * MwAirInterfacePac.QNAME.getRevision().get().toString()), getExtension("e1", - * "conditional-package", MwAirInterfacePac.QNAME.getModule().toString()))); LtpBuilder ltpBuilder1 - * = new LtpBuilder(); ltpBuilder1.setUuid(new UniversalId("MwAirInterfacePac")); - * ltpBuilder1.withKey(new LtpKey(new UniversalId("MwAirInterfacePacKey"))); - * ltpBuilder1.setLp(values) - */ - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, - ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, - ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, - ONFLayerProtocolName.Structure))); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public <R, RB extends Builder<R>, PLB extends Builder<?>> R getCurrentProblems(Class<PLB> plbClazz, - Class<RB> rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder<R> airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java deleted file mode 100644 index b042fd82a..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.wrapperc.WrapperMicrowaveModelRev181010; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model1211pObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev181010.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - nNodeBuilder.setHost(new Host(new IpAddress(new Ipv4Address("1.2.3.4")))); - nNodeBuilder.setPort(new PortNumber(2230)); - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, - ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, - ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, - ONFLayerProtocolName.Structure))); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public <R, RB extends Builder<R>, PLB extends Builder<?>> R getCurrentProblems(Class<PLB> plbClazz, - Class<RB> rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder<R> airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java deleted file mode 100644 index 8383812ef..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.wrapperc.WrapperMicrowaveModelRev170324; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemListBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model12ObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev170324.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - nNodeBuilder.setHost(new Host(new IpAddress(new Ipv4Address("1.2.3.4")))); - nNodeBuilder.setPort(new PortNumber(2230)); - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, ONFLayerProtocolName.Structure) - )); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public AirInterfaceCurrentProblems getMwAirInterfacePacCurrentProblems() { - /* - * CurrentProblemListBuilder currentProblemListBuilder = new CurrentProblemListBuilder(); - * currentProblemListBuilder.setProblemName("Problem1"); - * currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - * currentProblemListBuilder.setSequenceNumber(1); currentProblemListBuilder.setTimeStamp(new - * DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - * - * AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - * AirInterfaceCurrentProblemsBuilder(); - * airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder. - * build())); - * - * return airInterfaceCurrentProblemsBuilder.build(); - */ - return getCurrentProblems(CurrentProblemListBuilder.class, AirInterfaceCurrentProblemsBuilder.class); - } - - public <R, RB extends Builder<R>, PLB extends Builder<?>> R getCurrentProblems(Class<PLB> plbClazz, - Class<RB> rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder<R> airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java deleted file mode 100644 index b81d40d92..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java +++ /dev/null @@ -1,285 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Function is handling the NETCONF and the format used by database and restconf communication. - * - * Input supported for the formats used in NETCONF messages: - * - * Format1 ISO 8601 2017-01-18T11:44:49.482-05:00 - * - * Format2 NETCONF - pattern from ietf-yang-types "2013-07-15" Pattern: - * "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-](\d{2}):(\d{2}))" - * - * Format3 NETCONF DateAndTime CoreModel-CoreFoundationModule-TypeDefinitions vom - * 2016-07-01 Example1: 20170118114449.1Z Example2: 20170118114449.1-0500 Pattern: - * "\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}.\d+?(Z|[\+\-](\d{2})(\d{2}))" typedef DateAndTime { description - * "This primitive type defines the date and time according to the following structure: - * 'yyyyMMddhhmmss.s[Z|{+|-}HHMm]' where: yyyy '0000'..'9999' year MM '01'..'12' month dd '01'..'31' - * day hh '00'..'23' hour mm '00'..'59' minute ss '00'..'59' second s '.0'..'.9' tenth of second - * (set to '.0' if EMS or NE cannot support this granularity) Z 'Z' indicates UTC (rather than local - * time) {+|-} '+' or '-' delta from UTC HH '00'..'23' time zone difference in hours Mm '00'..'59' - * time zone difference in minutes."; type string; } Format4 E/// specific Example1: - * 2017-01-23T13:32:38-05:00 Example2: 2017-01-23T13:32-05:00 - * - * Input formats netconfTime as String according the formats given above - * - * Return format is String in ISO8601 Format for database and presentation. - * - * Example formats: - * 1) ISO8601. Example 2017-01-18T11:44:49.482-05:00 - * 2) Microwave ONF. Examples 20170118114449.1Z, 20170118114449.1-0500 - * 3.1) Ericson. Example: 2017-01-23T13:32:38-05:00 - * 3.2) Ericson. Example: 2017-01-23T13:32-05:00 - * Always 10 Groups, - * 1:Year 2:Month 3:day 4:Hour 5:minute 6:optional sec 7:optional ms 8:optional Z or 9:offset - * signedhour 10:min - * - * Template: - * private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); - */ - -public class NetconfTimeStampOld { - private static final Logger LOG = LoggerFactory.getLogger(NetconfTimeStampOld.class); - - private static final NetconfTimeStampOld CONVERTER = new NetconfTimeStampOld(); - - private final SimpleDateFormat dateFormatResult = init("yyyy-MM-dd'T'HH:mm:ss.S'Z'", TimeZone.getTimeZone("GMT")); - private final SimpleDateFormat dateFormatConvert = init("yyyy-MM-dd HH:mm:ss.S", TimeZone.getTimeZone("GMT")); - private static int MILLISECONDSDIGITS = 3; // Digits of milliseconds in dateFormatResult - private static String MILLISECONDZEROS = "000"; // String with zeros for milliseconds in dateFormatResult - private static final Pattern dateNetconfPatter = Pattern.compile( - "(\\d{4})-?(\\d{2})-?(\\d{2})T?(\\d{2}):?(\\d{2})(?:(?::?)(\\d{2}))?(?:.(\\d+))?(?:(Z)|([+-]\\d{2}):?(\\d{2}))"); - - /* - * ------------------------------------ Public function - */ - - /** - * Use static access - */ - private NetconfTimeStampOld() { - } - - /** - * Use this function to get the converter - * @return global converter - */ - public static NetconfTimeStampOld getConverter() { - return CONVERTER; - } - - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - * - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - public String getTimeStampAsNetconfString() { - return this.getRightFormattedDate(new Date().getTime()); - } - - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - public String getTimeStampAsNetconfString(Date date) { - return getRightFormattedDate(date.getTime()); - } - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - public DateAndTime getTimeStamp() { - return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString()); - } - - /** - * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * @param date specifying the date and time - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - public DateAndTime getTimeStamp(Date date) { - return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString(date)); - } - - - /** - * Return the String with a NETCONF time converted to long - * - * @param netconfTime as String according the formats given above - * @return Epoch milliseconds - * @throws IllegalArgumentException In case of no compliant time format definition for the string - * @throws ParseException Time parsing failed - */ - public long getTimeStampFromNetconfAsMilliseconds(String netconfTime) - throws IllegalArgumentException { - Matcher m = dateNetconfPatter.matcher(netconfTime); - // According to specified matches there have to be 10 parameter - if (m.matches() && m.groupCount() == 10) { - // Convert now - synchronized(dateFormatConvert) { - long utcMillis; - try { - utcMillis = dateFormatConvert.parse(getTimeAsNormalizedString(m, m.group(6), m.group(7))).getTime() - - getTimezoneOffsetMilliseconds(m.group(9), m.group(10)); - return utcMillis; - } catch (ParseException e) { - throw new IllegalArgumentException("Parse problem for NETCONF data string: " + netconfTime); - } - } - } else { - throw new IllegalArgumentException("No pattern for NETCONF data string: " + netconfTime); - } - } - - /** - * Deliver String result. - * - * @param netconfTime as String according the formats given above - * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed - * input" the Input string with the prefix "Mailformed date" is delivered back. - */ - public String getTimeStampFromNetconf(String netconfTime) { - Matcher m = dateNetconfPatter.matcher(netconfTime); - // According to spezified matches there have to be 10 parameter - if (m.matches() && m.groupCount() == 10) { - // Convert now - try { - synchronized(dateFormatConvert) { - long utcMillis = dateFormatConvert.parse(getTimeAsNormalizedString(m, m.group(6), m.group(7))).getTime() - - getTimezoneOffsetMilliseconds(m.group(9), m.group(10)); - return getRightFormattedDate(utcMillis); - } - } catch (ParseException e) { - LOG.info(e.getMessage()); - } catch (IllegalArgumentException e) { - LOG.info(e.getMessage()); - } - } - LOG.debug("No pattern for NETCONF data string: {}", netconfTime); - return "Malformed date: " + netconfTime; // Error handling - } - - /*------------------------------------------- - * Private and static functions - */ - /** - * Convert timeZone parameter in format [+-]/d/d:/d/d into milliseconds - * - * @param m Index 9 with "+/-" and hour string or null for UTZ, Index 10 with minutes - * @return long milliseconds of TimeZoneOffset - * @throws IllegalArgumentException If parameters are wrong - */ - private static long getTimezoneOffsetMilliseconds(String timeZoneHour, String timeZoneMinute) - throws IllegalArgumentException { - // -- Calculate timezone specific offset - long timeZoneOffsetMilliseconds = 0; - if (timeZoneHour != null) { - // Time zone offset in hours and minutes - int tzHour = 0; - int tzMinutes = 0; - tzHour = Integer.valueOf(timeZoneHour); - if (timeZoneMinute != null) { - tzMinutes = Integer.valueOf(timeZoneMinute); - } else { - throw new IllegalArgumentException("Problem in Netconf Time format timeZone minutes parameter."); - } - timeZoneOffsetMilliseconds = (tzHour * 60 + (tzHour > 0 ? tzMinutes : -tzMinutes)) * 60000L; - } - return timeZoneOffsetMilliseconds; - } - - /** - * Convert parameters to String with year .. minutes and optional Seconds and .. milliseconds - * - * @param m Matcher with parsed date - * @param secString Seconds as String or null - * @param msString Milliseconds as String or null - * @return Normalized time string - */ - private static String getTimeAsNormalizedString(Matcher m, String secString, String msString) { - // -- Create time as normalized string - StringBuffer sb = new StringBuffer(); - sb.append(m.group(1)); // year - sb.append('-'); - sb.append(m.group(2)); // Month - sb.append('-'); - sb.append(m.group(3)); // Day - sb.append(' '); - sb.append(m.group(4)); // Hour 0-23 - sb.append(':'); - sb.append(m.group(5)); // Minute - sb.append(':'); - sb.append(secString != null ? secString : "00"); // Seconds (optional) - sb.append('.'); - if (msString == null) { // Milliseconds optional - sb.append(MILLISECONDZEROS); - } else if (msString.length() <= MILLISECONDSDIGITS) { - sb.append(msString); // Millisecond - sb.append(MILLISECONDZEROS.substring(0, MILLISECONDSDIGITS - msString.length())); - } else { - sb.append(msString.substring(0, MILLISECONDSDIGITS)); // Only first Three - } - return sb.toString(); - } - - /** - * Deliver format in a way that milliseconds are correct. - * - * @param dateMillis Date as milliseconds in Java definition - * @return String - */ - private String getRightFormattedDate(long dateMillis) { - long tenthOfSeconds = dateMillis % 1000 / 100L; // Extract 100 milliseconds - long base = dateMillis / 1000L * 1000L; // Cut milliseconds to 000 - Date newDate = new Date(base + tenthOfSeconds); - synchronized(dateFormatResult) { - return dateFormatResult.format(newDate); - } - } - - /** - * Static initialization - */ - private static SimpleDateFormat init(String format, TimeZone zone) { - if (zone == null) { - throw new ExceptionInInitializerError(); - } else { - SimpleDateFormat dateFormat; - dateFormat = new SimpleDateFormat(format); - dateFormat.setTimeZone(zone); - return dateFormat; - } - } - - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java deleted file mode 100644 index cc33060f2..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.onfcore.container.ONFLayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.ExtensionBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpKey; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.LtpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.LtpKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapabilityBuilder; -import org.opendaylight.yangtools.yang.common.QName; - -public class ObjectBuilder { - - static AvailableCapabilitiesBuilder getAvailableCababilitiesList(QName... qNames) { - return getAvailableCababilitiesList(null, qNames); - } - - static AvailableCapabilitiesBuilder getAvailableCababilitiesList(AvailableCapabilitiesBuilder valueBuilder, - QName... qNames) { - if (valueBuilder == null) { - valueBuilder = new AvailableCapabilitiesBuilder(); - } - List<AvailableCapability> capabilites = new ArrayList<>(); - for (QName s : qNames) { - AvailableCapabilityBuilder capabilityBuilder = new AvailableCapabilityBuilder(); - capabilityBuilder.setCapability(s.toString()); - capabilites.add(capabilityBuilder.build()); - } - valueBuilder.setAvailableCapability(capabilites); - return valueBuilder; - } - - static Extension getExtension(String valueName, String value) { - ExtensionBuilder lpExtension = new ExtensionBuilder(); - lpExtension.setValueName(valueName); - lpExtension.setValue(value); - return lpExtension.build(); - } - - static Ltp getLtp(Class<?> clazz, QName qname, ONFLayerProtocolName onflayerProtocolName) { - String baseName = clazz.getSimpleName(); - LpBuilder lpBuilder = new LpBuilder(); - lpBuilder.withKey(new LpKey(new UniversalId(baseName + "LpKey"))); - lpBuilder.setLayerProtocolName(new LayerProtocolName(onflayerProtocolName.getValue())); - lpBuilder.setExtension(Arrays.asList(getExtension("capability", qname.getNamespace().toString()), - getExtension("revision", qname.getRevision().get().toString()), - getExtension("conditional-package", qname.getLocalName()))); - - LtpBuilder ltpBuilder = new LtpBuilder(); - ltpBuilder.setUuid(new UniversalId(baseName)); - ltpBuilder.setLp(Arrays.asList(lpBuilder.build())); - ltpBuilder.withKey(new LtpKey(new UniversalId(baseName + "LtpKey"))); - return ltpBuilder.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java deleted file mode 100644 index 327472703..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import com.google.common.util.concurrent.FluentFuture; -import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.NotificationService; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class ReadOnlyTransactionMountpoint1211Mock implements ReadTransaction, NotificationService { - - private final Model1211ObjectMock mock = new Model1211ObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model1211ObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - @Override - public <T extends DataObject> @NonNull FluentFuture<java.util.Optional<T>> read(@NonNull LogicalDatastoreType store, - @NonNull InstanceIdentifier<T> path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional<T> res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional<T>) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional<T>) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.empty(); - } - - FluentFuture<Optional<T>> res = FluentFuture.from(com.google.common.util.concurrent.Futures.immediateFuture(res1)); - return res; - - } - - - @Override - public void close() {} - - @Override - public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification(mock.getProblemNotification()); - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java deleted file mode 100644 index 7a074ce30..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import com.google.common.util.concurrent.FluentFuture; -import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.NotificationService; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class ReadOnlyTransactionMountpoint1211pMock implements ReadTransaction, NotificationService { - - private final Model1211pObjectMock mock = new Model1211pObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model1211pObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - - @Override - public <T extends DataObject> @NonNull FluentFuture<java.util.Optional<T>> read(@NonNull LogicalDatastoreType store, - @NonNull InstanceIdentifier<T> path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional<T> res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional<T>) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional<T>) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.empty(); - } - - FluentFuture<Optional<T>> res = FluentFuture.from(com.google.common.util.concurrent.Futures.immediateFuture(res1)); - return res; - - } - - - @Override - public void close() {} - - @Override - public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification(mock.getProblemNotification()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java deleted file mode 100644 index d27330328..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import com.google.common.util.concurrent.FluentFuture; -import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.NotificationService; -import org.opendaylight.mdsal.binding.api.ReadTransaction; -import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -public class ReadOnlyTransactionMountpoint12Mock implements ReadTransaction, NotificationService { - - private final Model12ObjectMock mock = new Model12ObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model12ObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - @Override - public <T extends DataObject> @NonNull FluentFuture<java.util.Optional<T>> read(@NonNull LogicalDatastoreType store, - @NonNull InstanceIdentifier<T> path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional<T> res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional<T>) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional<T>) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional<T>) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.empty(); - } - FluentFuture<Optional<T>> res = FluentFuture.from(com.google.common.util.concurrent.Futures.immediateFuture(res1)); - return res; - - } - - @Override - public void close() {} - - @Override - public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification( - mock.getProblemNotification() - ); - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ResourceFileLoader.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ResourceFileLoader.java deleted file mode 100644 index 6c944e4c1..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ResourceFileLoader.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.io.File; - -public class ResourceFileLoader { - - public static File getFile(Object o, String fileName) { - ClassLoader classLoader = o.getClass().getClassLoader(); - return new File(classLoader.getResource(fileName).getFile()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java deleted file mode 100644 index 9a926fd64..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH 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.features.sdnr.wt.devicemanager.test.util; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -public class ZipFile implements AutoCloseable { - - private final ZipOutputStream zos; - private final FileOutputStream fos; - - public ZipFile(String zipPath) throws FileNotFoundException { - fos = new FileOutputStream(zipPath); - zos = new ZipOutputStream(fos); - } - - public void addToZipFile(String fileName) throws FileNotFoundException, IOException { - - System.out.println("Writing '" + fileName + "' to zip file"); - - InputStream fis = ZipFile.class.getClassLoader().getResourceAsStream(fileName); - if (fis == null) { - throw new FileNotFoundException("Resource not found: " + fileName); - } - - ZipEntry zipEntry = new ZipEntry(fileName); - zos.putNextEntry(zipEntry); - byte[] bytes = new byte[1024]; - int length; - while ((length = fis.read(bytes)) >= 0) { - zos.write(bytes, 0, length); - } - zos.closeEntry(); - fis.close(); - } - - @Override - public void close() throws IOException { - zos.close(); - fos.close(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties b/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties deleted file mode 100644 index 3e4da05b0..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties +++ /dev/null @@ -1,165 +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=========================================================
-
-###
-
-
-
-#
-
-# Configuration file for A&AI Client
-
-#
-
-
-
-#
-
-# Certificate keystore and truststore
-
-#
-
-org.onap.ccsdk.sli.adaptors.aai.ssl.trust=/opt/logs/externals/data/stores/truststore.client.jks
-
-org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd=adminadmin
-
-
-
-org.onap.ccsdk.sli.adaptors.aai.ssl.key=/opt/logs/externals/data/stores/keystore.client.p12
-
-org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=adminadmin
-
-org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=true
-
-
-
-org.onap.ccsdk.sli.adaptors.aai.application=SDNC
-
-
-
-#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int1.test.att.com:8443
-
-org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-pwt3.ecomp.cci.att.com:8443
-
-
-
-connection.timeout=60000
-
-read.timeout=60000
-
-
-
-# query
-
-org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v13/search/sdn-zone-query
-
-org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v13/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name}
-
-org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v13/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3
-
-
-
-# named query
-
-org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query
-
-
-
-#update
-
-org.onap.ccsdk.sli.adaptors.aai.update=/aai/v13/actions/update
-
-
-
-# UBB Notify
-
-org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v13/actions/notify
-
-org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id}
-
-org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information
-
-
-
-# P-Interfaces
-
-org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces
-
-org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}
-
-
-
-# VNF IMAGES
-
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v13/service-design-and-creation/vnf-images
-
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v13/service-design-and-creation/vnf-images/vnf-image/{att-uuid}
-
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor}
-
-
-
-# service instance
-
-org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query=/aai/v13/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance
-
-org.onap.ccsdk.sli.adaptors.aai.path.service.instance=/aai/v13/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
-
-
-
-# VNF IMAGES QUERY
-
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor}
-
-
-
-#
-
-# Formatting
-
-#
-
-org.onap.ccsdk.sli.adaptors.aai.param.format=filter=%s:%s
-
-org.onap.ccsdk.sli.adaptors.aai.param.vnf_type=vnf-type
-
-org.onap.ccsdk.sli.adaptors.aai.param.physical.location.id=physical-location-id
-
-org.onap.ccsdk.sli.adaptors.aai.param.service.type=service-type
-
-
\ No newline at end of file diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf b/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf deleted file mode 100644 index 8489f0905..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf +++ /dev/null @@ -1,72 +0,0 @@ - -odl-cluster-data { - - akka { - loglevel = "" - remote { - netty.tcp { - hostname = "zltcdyh1arbc02.2f0377.dyh1a.tci.att.com" - port = 2550 - } - } - actor { - debug{ - autoreceive = on - lifecycle = on - unhandled = on - fsm = on - event-stream = on - } - } - cluster { - seed-nodes = ["akka.tcp://opendaylight-cluster-data@zltcdyh1arbc01.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1arbc02.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1arbc03.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc01.f84e7a.dyh1b.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc02.f84e7a.dyh1b.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc03.f84e7a.dyh1b.tci.att.com:2550"] - seed-node-timeout = 15s - roles = ["member-2"] - - } - persistence { - journal-plugin-fallback { - circuit-breaker { - max-failures = 10 - call-timeout = 60s - reset-timeout = 30s - } - } - } - } -} - -odl-cluster-rpc { - - akka { - loglevel = "" - remote { - netty.tcp { - hostname = "zltcdyh1arbc02.2f0377.dyh1a.tci.att.com" - port = 2551 - } - } - actor { - debug{ - autoreceive = on - lifecycle = on - unhandled = on - fsm = on - event-stream = on - } - } - cluster { - seed-nodes = ["akka.tcp://odl-cluster-rpc@zltcdyh1arbc01.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1arbc02.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1arbc03.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc01.f84e7a.dyh1b.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc02.f84e7a.dyh1b.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc03.f84e7a.dyh1b.tci.att.com:2551"] - seed-node-timeout = 15s - } - persistence { - journal-plugin-fallback { - circuit-breaker { - max-failures = 10 - call-timeout = 60s - reset-timeout = 30s - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json b/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json deleted file mode 100644 index c7db70121..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "uri":"/mwtn/mediator-server/_query", - "method":"DELETE", - "body":{"query":{"match_all":{}}} - }, - - { - "uri":"/mwtn/mediator-server/1", - "method":"POST", - "body":{ - "id": 1, - "name": "internal mediatorserver", - "url": "http://192.168.178.89:7070" - - } - } -] diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties deleted file mode 100644 index bdc3c1009..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,40 +0,0 @@ -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. - -# Default logging detail level for all instances of SimpleLogger. -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=info - -# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz". -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, the default logging detail level is used. -# org.slf4j.simpleLogger.log.xxx.yyy=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.test=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.database=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info - -# Set to true if you want the current date and time to be included in output messages. -# Default is false, and will output the number of milliseconds elapsed since startup. -#org.slf4j.simpleLogger.showDateTime=false - -# The date and time format to be used in the output messages. -# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. -# If the format is not specified or is invalid, the default format is used. -# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. -#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z - -# Set to true if you want to output the current thread name. -# Defaults to true. -#org.slf4j.simpleLogger.showThreadName=true - -# Set to true if you want the Logger instance name to be included in output messages. -# Defaults to true. -#org.slf4j.simpleLogger.showLogName=true - -# Set to true if you want the last component of the name to be included in output messages. -# Defaults to false. -#org.slf4j.simpleLogger.showShortLogName=false diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties b/sdnr/wt/devicemanager/provider/src/test/resources/test.properties deleted file mode 100644 index de49c5893..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties +++ /dev/null @@ -1,55 +0,0 @@ -[dcae] -dcaeUserCredentials=admin:admin -dcaeUrl=off -dcaeHeartbeatPeriodSeconds=120 -dcaeTestCollector=no - -[aots] -userPassword=passwd -soapurladd=off -soapaddtimeout=10 -soapinqtimeout=20 -userName=user -inqtemplate=inqreq.tmpl.xml -assignedto=userid -addtemplate=addreq.tmpl.xml -severitypassthrough=critical,major,minor,warning -systemuser=user -prt-offset=1200 -soapurlinq=off -#smtpHost= -#smtpPort= -#smtpUsername= -#smtpPassword= -#smtpSender= -#smtpReceivers= - -[es] -esCluster=sendateodl5 -#time limit to keep increasing data in database [in seconds] -#60*60*24*30 (30days) -esArchiveLimit=2592000 -#folder where removed data will be stored -esArchiveFolder=./backup -#interval to archive database [in seconds] -#60*60*24 (1day) -esArchiveInterval=86400 - -[aai] -#keep comment -aaiHeaders=["X-TransactionId: 9999"] -aaiUrl=http://localhost:81 -aaiUserCredentials=AAI:AAI -aaiDeleteOnMountpointRemove=false -aaiTrustAllCerts=false -aaiApiVersion=aai/v13 -aaiPropertiesFile=aaiclient.properties -aaiApplicationId=SDNR -aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12 -aaiPcks12ClientCertPassphrase=adminadmin -aaiClientConnectionTimeout=30000 - -[pm] -pmCluster=sendateodl5 -pmEnabled=true - |