aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test/java')
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/ExampleHttpClient.java81
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/TestMappEquipment.java39
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaePrivateTester.java110
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaeTestClient.java71
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/HttpsClient.java304
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java232
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java138
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java203
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java245
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java (renamed from sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/Test1dm.java)172
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java63
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java85
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java25
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java27
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java91
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java91
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java91
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java58
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java9
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java14
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java35
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java17
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ReadOnlyTransactionMock.java143
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java151
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java138
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java160
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java85
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java208
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java209
-rw-r--r--sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java199
30 files changed, 2698 insertions, 796 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/ExampleHttpClient.java b/sdnr/wt/devicemanager/provider/src/test/java/ExampleHttpClient.java
deleted file mode 100644
index c5426e3b6..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/ExampleHttpClient.java
+++ /dev/null
@@ -1,81 +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==========================================================================
- ******************************************************************************/
-
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPClient;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.http.BaseHTTPResponse;
-
-/*
- * base... baseURL, e.g. http://10.10.55.11:8432/api/paut/
- *
- * usage: this.sendRequest()
- * uri... all after the baseURL => request-url=base+uri
- * headers: https://developer.mozilla.org/de/docs/Web/HTTP/Headers
- *
- */
-public class ExampleHttpClient extends BaseHTTPClient{
-
- private final String username;
- private final String password;
-
- /*
- * for normal http request without ssl client certificate authorization
- */
- public ExampleHttpClient(String base, boolean trustAllCerts,String user,String passwd)
- {
- super(base,trustAllCerts);
- this.username=user;
- this.password=passwd;
- int timeout=60000;//http timeout in ms
- this.setTimeout(timeout);
-
-
- }
- /*
- * for client cert authorization
- */
- public ExampleHttpClient(String base, boolean trustAllCerts, String certFilename, String passphrase,
- int sslCertType) {
- super(base, trustAllCerts, certFilename, passphrase, sslCertType);
- this.username="";
- this.password="";
-
- }
-
-
- public void doExamplePost(String param1,int param2) throws IOException
- {
- String uri="network/pnf/id";
- String method="GET";
- String body=String.format("{\"param1\":\"%s\",\"param1\":%d}",param1,param2);
- Map<String, String> headers = new HashMap<String,String>();
- headers.put("Accept-Encoding", "utf-8");
- headers.put("Authorization", BaseHTTPClient.getAuthorizationHeaderValue(this.username, this.password));
- BaseHTTPResponse response=this.sendRequest(uri, method, body, headers );
-
- if(response.code==BaseHTTPResponse.CODE200)
- {
-
- }
-
-
- }
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/TestMappEquipment.java b/sdnr/wt/devicemanager/provider/src/test/java/TestMappEquipment.java
deleted file mode 100644
index fd7773554..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/TestMappEquipment.java
+++ /dev/null
@@ -1,39 +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==========================================================================
- ******************************************************************************/
-
-public class TestMappEquipment<T> {
-
- public static void main(String[] args) {
-
- /*
- MyEquipmentBuilder eb = new MyEquipmentBuilder();
- eb.setAdministrativeState(AdministrativeState.Unlocked);
- eb.setCategory((new CategoryBuilder()).setCategory(EquipmentCategory.Rack).build());
-
- Equipment e2 = eb.build();
-
- String inspect = HtDatabaseEventsService.inspect(e2,0);
- System.out.println("Inspect: "+inspect);
-
- String json = HtDatabaseEventsService.toJson(e2);
- System.out.println("JSON: "+json);
- */
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaePrivateTester.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaePrivateTester.java
deleted file mode 100644
index e9ccc53b3..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaePrivateTester.java
+++ /dev/null
@@ -1,110 +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.dcaeConnector.test;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.cert.X509Certificate;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-public class DcaePrivateTester {
-
-
- public static void test(URL url, boolean readFromServer) throws Exception {
- // Create a trust manager that does not validate certificate chains
- TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
- @Override
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- @Override
- public void checkClientTrusted(X509Certificate[] certs, String authType) {
- }
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String authType) {
- }
- } };
- // Install the all-trusting trust manager
- final SSLContext sc = SSLContext.getInstance("TLS");
- sc.init(null, trustAllCerts, new java.security.SecureRandom());
- HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- // Create all-trusting host name verifier
- HostnameVerifier allHostsValid = (hostname, session) -> true;
-
- // Install the all-trusting host verifier
- HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
-
- //URL url = new URL("https://www.google.com");
- URLConnection con = url.openConnection();
- System.out.println("Connection background: "+con.getClass().getName()+" "+url.getHost());
-
- if (readFromServer) {
- final Reader reader = new InputStreamReader(con.getInputStream());
- final BufferedReader br = new BufferedReader(reader);
- String line = "";
- while ((line = br.readLine()) != null) {
- System.out.println(line);
- }
- br.close();
- } /**/
- } // End of main
-
-
-
-// httpTestUrl=https://plan.fritz.box:9092/ux/#
-// keyStore=etc/clientkeystore
-// keyStorePassword=daylight2016
- public static void main(String[] args) {
-
- String urlString = "https://www.google.de";
- //String urlString = "https://plan.fritz.box:9092/ux/#";
- //String urlString = "http://plan.fritz.box:9091/ux/#";
- //String urlString = "http://127.0.0.1:30000/eventListener/v3";
-
- try {
- test(new URL(urlString), true);
- } catch (Exception e) {
- System.out.println("(..something..) failed");
- e.printStackTrace();
- }
- /*
- System.out.println("Test HTTPS");
-
- final HttpsClient httpTestClient;
- httpTestClient = new HttpsClient();
-
- httpTestClient.testIt(
- //"https://plan.fritz.box:9092/ux/#",
- "https://www.google.de",
- "/home/herbert/odl/distribution-karaf-0.5.1-Boron-SR1/etc/clientkeystore",
- "daylight2016"
- );/**/
-
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaeTestClient.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaeTestClient.java
deleted file mode 100644
index ffc007a06..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/DcaeTestClient.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.dcaeConnector.test;
-
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeMessages;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeSenderImpl;
-
-public class DcaeTestClient {
-
- private static final boolean TESTCOLLECTOR_YES = true;
-
- public static void main(String[] args) {
-
- System.out.println("Test program to verify DCAE https connectivity");
-
- //Get configuration
- DcaeConfig configuration = DcaeConfig.getDefaultConfiguration();
-
- if (configuration != null) {
-
- //Start services
- System.out.println("Configuration: "+configuration);
-
- DcaeSenderImpl dcaeClient = new DcaeSenderImpl(configuration.getEventReveicerUrl(), configuration.getUserCredentials());
-
- if (TESTCOLLECTOR_YES) {
- System.out.println("Connect to testclient and send notifications");
-
- DcaeMessages dcaeMessages = new DcaeMessages(dcaeClient, "ControllerName", 31, null);
-
- for (int t=0; t < 2; t++) {
- try {
- Thread.sleep(1000); //1000 milliseconds is one second.
- } catch(InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- System.out.println(t+". Send notification and receive answer message");
- System.out.println("Heartbeat message: "+dcaeMessages.postHeartBeat());
- System.out.println("Status of ECOMP Client: "+dcaeClient.getStatusAsString());
- }
-
- } else {
-
- System.out.println("Connect to server and receive initial answer.");
- System.out.println("Message: "+dcaeClient.testConnectServer());
-
- }
-
- }
- }
-
-}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/HttpsClient.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/HttpsClient.java
deleted file mode 100644
index 6ff18b48f..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/dcaeConnector/test/HttpsClient.java
+++ /dev/null
@@ -1,304 +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.dcaeConnector.test;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient;
-
-public class HttpsClient{
-
- private static final MyLogger LOG = MyLogger.getLogger(DcaeProviderClient.class);
-
- void test() {
-
- TrustManager tm = new X509TrustManager() {
-
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws java.security.cert.CertificateException {
- //do nothing, you're the client
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws java.security.cert.CertificateException {
- /* chain[chain.length -1] is the candidate for the
- * root certificate.
- * Look it up to see whether it's in your list.
- * If not, ask the user for permission to add it.
- * If not granted, reject.
- * Validate the chain using CertPathValidator and
- * your list of trusted roots.
- */
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- //also only relevant for servers
- return null;
- }
- };
-
- TrustManager tml[] = new TrustManager[1];
- tml[0] = tm;
-
-
- try {
- SSLContext ctx = SSLContext.getInstance("TLS");
- ctx.init(null, tml, null);
- @SuppressWarnings("unused")
- SSLSocketFactory sslF = ctx.getSocketFactory();
-
- } catch (NoSuchAlgorithmException | KeyManagementException e) {
- e.printStackTrace();
- }
-
-
- };
-
- void setupAllTrustingManager() {
- // Create a trust manager that does not validate certificate chains
- TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager(){
- @Override
- public X509Certificate[] getAcceptedIssuers(){return null;}
- @Override
- public void checkClientTrusted(X509Certificate[] certs, String authType){}
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String authType){}
- }};
-
- // Install the all-trusting trust manager
- try {
- SSLContext sc = SSLContext.getInstance("TLS");
- sc.init(null, trustAllCerts, new SecureRandom());
- HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- } catch (Exception e) {
- ;
- }
- }
-
- void testIt(String https_url, String keyStoreName, String keyStorePassword){
-
- LOG.info("Message to: {} begin.", https_url);
-
- if (https_url.equals("off")) {
- LOG.info("Function switched off");
- return;
- }
-
- /*
- KeyManagerFactory keyManagerFactory = null;
-
- try {
- KeyStore ks = KeyStore.getInstance("JKS");
- FileInputStream in = new FileInputStream(keyStoreName);
- ks.load(in, keyStorePassword.toCharArray());
-
- CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
- FileInputStream in2 = new FileInputStream("etc/eventprovider.cert");
- X509Certificate cert = (X509Certificate)certFactory.generateCertificate(in2);
-
- KeyStore.Entry newEntry = new KeyStore.TrustedCertificateEntry(cert);
- ks.setEntry("someAlias", newEntry, null);
-
- keyManagerFactory = KeyManagerFactory.getInstance("X509");
- keyManagerFactory.init(ks, "yourKeyStorePassword".toCharArray());
-
- } catch (KeyStoreException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- } catch (FileNotFoundException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- } catch (NoSuchAlgorithmException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- } catch (CertificateException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- } catch (IOException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- } catch (UnrecoverableKeyException e1) {
- LOG.info("Exception: {}", e1.getMessage());
- }
-
- // Create a trust manager that does not validate certificate chains
- TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager(){
- @Override
- public X509Certificate[] getAcceptedIssuers(){return null;}
- @Override
- public void checkClientTrusted(X509Certificate[] certs, String authType){}
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String authType){}
- }};
- */
- File file = new File(keyStoreName);
- LOG.info("Setup keystore begin "+keyStoreName+" "+keyStorePassword+" Exists: "+file.exists());
-
- System.setProperty("javax.net.debug","ssl");
- System.setProperty("javax.net.ssl.keyStoreType", "jks");
- System.setProperty("javax.net.ssl.keyStore", keyStoreName);
- System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
-
- LOG.info("Setup keystore complete");
-
- javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
- (hostname, sslSession) -> {
- LOG.info("Hostname check {}", hostname);
- return true;
- });
- LOG.info("Setup name verifier.");
-
- try {
- /*
- SSLContext sslContext = SSLContext.getInstance("TLS");
- sslContext.init(keyManagerFactory.getKeyManagers(), trustAllCerts, null);
- SSLContext.setDefault(sslContext);
- */
-
- URL url = new URL(https_url);
- LOG.info("Url object created");
-
- HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
-
- LOG.info("openConnection");
-
- //dumpl all cert info
- print_https_cert(con);
-
- //dump all the content
- print_content(con);
-
- } catch (MalformedURLException e) {
- LOG.info("Exception: {}", e.getMessage());
- } catch (IOException e) {
- LOG.info("Exception: {}", e.getMessage());
- }
-
- LOG.info("Message to: {} end.", https_url);
-
- }
-
- private void print_https_cert(HttpsURLConnection con){
-
- StringBuffer logMsg = new StringBuffer();
-
- if(con!=null){
-
- try {
- logMsg.append("Response Code : " + con.getResponseCode());
- logMsg.append("Cipher Suite : " + con.getCipherSuite());
- logMsg.append("\n");
-
- Certificate[] certs = con.getServerCertificates();
- for(Certificate cert : certs){
- logMsg.append("Cert Type : " + cert.getType());
- logMsg.append("Cert Hash Code : " + cert.hashCode());
- logMsg.append("Cert Public Key Algorithm : " + cert.getPublicKey().getAlgorithm());
- logMsg.append("Cert Public Key Format : " + cert.getPublicKey().getFormat());
- logMsg.append("\n");
- }
-
-
- } catch (SSLPeerUnverifiedException e) {
- logMsg.append(e.getMessage());
- } catch (IOException e){
- logMsg.append(e.getMessage());
- }
- } else {
- logMsg.append("No connection");
- }
-
- LOG.info(logMsg.toString());
- }
-
- private void print_content(HttpsURLConnection con){
-
- StringBuffer logMsg = new StringBuffer();
- if(con!=null){
-
- try {
-
-
- logMsg.append("****** Content of the URL ********");
- BufferedReader br =
- new BufferedReader(
- new InputStreamReader(con.getInputStream()));
-
- String input;
-
- while ((input = br.readLine()) != null){
- logMsg.append(input);
- }
- br.close();
-
-
- } catch (IOException e) {
- logMsg.append(e.getMessage());
- }
-
- } else {
- logMsg.append("No connection");
- }
-
- LOG.info(logMsg.toString());
-
- }
-
- private static class MyLogger {
-
- private void out( String s, Object...oList) {
- StringBuffer sb = new StringBuffer();
- sb.append("-------> ");
- sb.append(s);
- sb.append(" P: ");
- int t = 0;
- for (Object o: oList) {
- sb.append("[");
- sb.append(t++);
- sb.append("](");
- sb.append(o.toString());
- sb.append(")");
- }
- System.out.println(sb.toString());
- }
-
- void info( String s, Object...o) {
- out(s,o);
- }
-
- static MyLogger getLogger(Class<?> c) {
- return new MyLogger();
- }
- }
-}
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
new file mode 100644
index 000000000..2ce5ec9d3
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * ============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.devicemanager.aaiconnector.impl.AaiProviderClient;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import com.google.common.io.Files;
+
+public class TestAai {
+
+ private static final String ENABLEDAAI_TESTCONFIG_FILENAME = "test2.properties";
+ 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 HtDevicemanagerConfiguration cfg;
+
+ @Test
+ public void test() {
+ HtDevicemanagerConfiguration cfg=HtDevicemanagerConfiguration.getTestConfiguration();
+
+ 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) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ 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);
+ 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(new File(ENABLEDAAI_TESTCONFIG_FILENAME), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ cfg=HtDevicemanagerConfiguration.getTestConfiguration(ENABLEDAAI_TESTCONFIG_FILENAME,true);
+ cfg.getAai().reload();
+ this.server = HttpServer.create(new InetSocketAddress(AAI_SERVER_PORT), 0);
+ this.httpThreadPool = Executors.newFixedThreadPool(5);
+ this.server.setExecutor(this.httpThreadPool);
+ this.server.createContext(cfg.getAai().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" );
+ }
+ }
+ 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
new file mode 100644
index 000000000..a9df83d0c
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * ============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.config.impl.AkkaConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.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: ");
+ 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/TestDcae.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
new file mode 100644
index 000000000..6d7cdd130
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * ============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.devicemanager.base.internalTypes.InternalDateAndTime;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import com.google.common.io.Files;
+
+public class TestDcae {
+
+ private static final String ENABLEDDCAE_TESTCONFIG_FILENAME = "test2.properties";
+ 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 HtDevicemanagerConfiguration cfg;
+
+ @Test
+ public void test2() {
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ 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");
+ InventoryInformation ii=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(new File(ENABLEDDCAE_TESTCONFIG_FILENAME), StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT);
+ } catch (IOException e1) {
+ fail(e1.getMessage());
+ }
+ cfg=HtDevicemanagerConfiguration.getTestConfiguration(ENABLEDDCAE_TESTCONFIG_FILENAME,true);
+ cfg.getDcae().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" );
+ }
+ }
+ 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
new file mode 100644
index 000000000..3a6655d60
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * ============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 java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.After;
+import org.junit.Before;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig;
+
+import com.google.common.io.Files;
+
+public class TestDevMgrPropertiesFile {
+
+ private static final String FILENAME = "test.properties";
+ private static final String AAIPROP_FILE="aaiclient.properties";
+ protected boolean hasChanged;
+
+ @Before
+ public void init() {
+ File f=new File(FILENAME);
+ if(f.exists()) {
+ f.delete();
+ }
+ f=new File(AAIPROP_FILE);
+ if(f.exists()) {
+ f.delete();
+ }
+ }
+ @After
+ public void deinit() {
+ this.init();
+ }
+
+ //@Test
+ public void test() {
+ File f=new File(FILENAME);
+ hasChanged=false;
+ try {
+ Files.asCharSink(f, StandardCharsets.UTF_8).write(this.getContent1());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ };
+ f=new File(AAIPROP_FILE);
+ try {
+ Files.asCharSink(f, StandardCharsets.UTF_8).write(this.getAaiPropertiesConfig());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ };
+ HtDevicemanagerConfiguration cfg=HtDevicemanagerConfiguration.getTestConfiguration(FILENAME);
+ assertNotNull(cfg.getAai());
+ assertNotNull(cfg.getDcae());
+ assertNotNull(cfg.getPm());
+ assertNotNull(cfg.getEs());
+ assertNotNull(cfg.getToggleAlarm());
+ assertTrue(AaiConfig.isInstantiated());
+ assertTrue(DcaeConfig.isInstantiated());
+ assertTrue(PmConfig.isInstantiated());
+ assertTrue(EsConfig.isInstantiated());
+ assertTrue(ToggleAlarmConfig.isInstantiated());
+
+
+ assertFalse(cfg.getAai().equals(AaiConfig.getDefaultConfiguration()));
+ assertFalse(cfg.getDcae().equals(DcaeConfig.getDefaultConfiguration()));
+ assertFalse(cfg.getPm().equals(PmConfig.getDefaultConfiguration()));
+ assertFalse(cfg.getEs().equals(EsConfig.getDefaultConfiguration()));
+ assertFalse(cfg.getToggleAlarm().equals(ToggleAlarmConfig.getDefaultConfiguration()));
+ System.out.println(cfg.getAai().toString());
+ System.out.println(cfg.getDcae().toString());
+ System.out.println(cfg.getPm().toString());
+ System.out.println(cfg.getEs().toString());
+ System.out.println(cfg.getToggleAlarm().toString());
+ cfg.registerConfigChangedListener(() -> {
+ hasChanged=true;
+ System.out.println("file changed listener triggered");
+ AaiConfig.reload();
+ DcaeConfig.reload();
+ PmConfig.reload();
+ EsConfig.reload();
+ ToggleAlarmConfig.reload();
+
+ });
+ try {
+ Files.asCharSink(f, StandardCharsets.UTF_8).write(this.getContent2());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ };
+ int i=0;
+ while(!hasChanged && i++<10) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ }
+
+ }
+ assertTrue("fileChanged not covered",hasChanged);
+ assertFalse(cfg.getAai().hashCode()==AaiConfig.getDefaultConfiguration().hashCode());
+ assertFalse(cfg.getDcae().hashCode()==DcaeConfig.getDefaultConfiguration().hashCode());
+ assertFalse(cfg.getPm().hashCode()==PmConfig.getDefaultConfiguration().hashCode());
+ assertFalse(cfg.getEs().hashCode()==EsConfig.getDefaultConfiguration().hashCode());
+ assertFalse(cfg.getToggleAlarm().hashCode()==ToggleAlarmConfig.getDefaultConfiguration().hashCode());
+
+ HtDevicemanagerConfiguration.clear();
+
+
+ }
+ private CharSequence 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=\"\"\n" +
+ "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=\"\"\n" +
+ "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=\"false\"\n" +
+ "org.onap.ccsdk.sli.adaptors.aai.application=\"\"\n" +
+ "org.onap.ccsdk.sli.adaptors.aai.uri=\"\"\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/Test1dm.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java
index 358a17c39..76684e50f 100644
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/Test1dm.java
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java
@@ -28,9 +28,14 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.json.JSONException;
+import org.json.JSONObject;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseWebAPIClient;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerService.Action;
import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.DataBrokerNetconfMock;
@@ -38,41 +43,55 @@ 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.opendaylight.controller.md.sal.binding.api.DataBroker;
+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.opendaylight.controller.md.sal.binding.api.MountPointService;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-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.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 Test1dm {
+public class TestDeviceManagerWithDatabase {
private static int DATABASETIMEOUTSECONDS = 30;
private static Path KARAF_ETC = Paths.get("etc");
private static DeviceManagerImpl deviceManager;
private static MountPointMock mountPoint;
+ private static DataBrokerNetconfMock dataBrokerNetconf;
+
+ 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);
//Create mocks
- DataBroker dataBroker = new DataBrokerNetconfMock();
- MountPointService mountPointService = new MountPointServiceMock(mountPoint = new MountPointMock());
+ ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock();
+ dataBrokerNetconf = new DataBrokerNetconfMock();
+ dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction);
+ mountPoint = new MountPointMock();
+ mountPoint.setReadOnlyTransaction(readOnlyTransaction);
+ MountPointService mountPointService = new MountPointServiceMock(mountPoint);
NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
RpcProviderRegistry rpcProviderRegistry = new RpcProviderRegistryMock();
//start using blueprint interface
deviceManager = new DeviceManagerImpl();
- deviceManager.setDataBroker(dataBroker);
+ deviceManager.setDataBroker(dataBrokerNetconf);
deviceManager.setMountPointService(mountPointService);
deviceManager.setNotificationPublishService(notificationPublishService);
deviceManager.setRpcProviderRegistry(rpcProviderRegistry);
@@ -82,9 +101,12 @@ public class Test1dm {
} catch (Exception e) {
e.printStackTrace();
}
+
+ readOnlyTransaction.close();
System.out.println("Initialization status: "+deviceManager.isDevicemanagerInitializationOk());
assertTrue("Devicemanager not initialized", deviceManager.isDevicemanagerInitializationOk());
System.out.println("Initialization done");
+
}
@AfterClass
@@ -102,6 +124,18 @@ public class Test1dm {
}
@Test
+ public void test0() throws InterruptedException {
+ HtDatabaseWebAPIClient client = new HtDatabaseWebAPIClient();
+ try {
+ String response = client.sendRequest("/mwtn/mediator-server/_search", "GET",
+ new JSONObject("{\"match\":{\"id\":id}}"));
+ System.out.println(response);
+ } catch (JSONException | IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
public void test1() throws InterruptedException {
System.out.println("Test1: Wait for database");
@@ -117,41 +151,146 @@ public class Test1dm {
public void test2() {
System.out.println("Test2: slave mountpoint");
- mountPoint.setDatabrokerAbsent(true);
- NodeId nodeId = new NodeId("mountpointTest1");
- NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder();
+ ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock();
+ dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction);
+ mountPoint.setReadOnlyTransaction(readOnlyTransaction);
+ NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode();
- System.out.println("Call devicemanager");
+ mountPoint.setDatabrokerAbsent(true);
+ NodeId nodeId = new NodeId("mountpointTest2");
try {
- deviceManager.startListenerOnNodeForConnectedState(Action.ADD, nodeId, nNodeBuilder.build());
+ deviceManager.startListenerOnNodeForConnectedState(Action.ADD, 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");
+ 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("mountpointTest2");
- NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder();
+ NodeId nodeId = new NodeId("mountpointTest3");
- System.out.println("Call devicemanager");
+ Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode);
+ System.out.println("Node capabilites: "+capabilities);
try {
- deviceManager.startListenerOnNodeForConnectedState(Action.ADD, nodeId, nNodeBuilder.build());
+ deviceManager.startListenerOnNodeForConnectedState(Action.ADD, nodeId, nNode);
} catch (Exception e) {
e.printStackTrace();
fail("Exception received.");
}
+
+ 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.ADD, 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.ADD, 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");
+ Resources.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");
+
+ }
+
//********************* Private
private static void delete(Path etc) throws IOException {
@@ -172,4 +311,5 @@ public class Test1dm {
}
}
+
}
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
new file mode 100644
index 000000000..5b00cbb78
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * ============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.config.impl.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
new file mode 100644
index 000000000..1d97eb85b
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * ============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.database.types.EsMaintenanceFilter;
+
+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() {
+ EsMaintenanceFilter fi = new EsMaintenanceFilter();
+ String fiAsString;
+
+ fiAsString = fi.toString();
+ System.out.println("Default 1: " + fiAsString);
+ if (! fiAsString.equals(DEFAULT1)) {
+ fail("Time conversion not OK");
+ }
+ }
+ @Test
+ public void test2() {
+ EsMaintenanceFilter fi = new EsMaintenanceFilter();
+ String fiAsString;
+
+ fi.setEndAsString("2018-01-01T10:00:00+05:00");
+ fiAsString = fi.toString();
+ System.out.println("Default 2: " + fi);
+ System.out.println("As String: " + fi.getEndAsString());
+ if (! fiAsString.equals(DEFAULT2)) {
+ fail("Time conversion not OK");
+ }
+ }
+ @Test
+ public void test3() {
+
+ boolean res;
+
+ ZonedDateTime start = ZonedDateTime.parse("2018-01-01T10:00:00+05:00");
+ ZonedDateTime end = ZonedDateTime.parse("2019-01-01T10:00:00+05:00");
+ ZonedDateTime now;
+
+ now = ZonedDateTime.parse("2017-05-01T10:00:00+05:00");
+ res = EsMaintenanceFilter.isInPeriod(start, end, now);
+ System.out.println("Before: " + res);
+ assertFalse("before period", res);
+
+ now = ZonedDateTime.parse("2018-05-01T10:00:00+05:00");
+ res = EsMaintenanceFilter.isInPeriod(start, end, now);
+ System.out.println("Within: " + res);
+ assertTrue("within period",res);
+
+ now = ZonedDateTime.parse("2019-05-01T10:00:00+05:00");
+ res = EsMaintenanceFilter.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
index 4166101c4..0ce62d5c6 100644
--- 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
@@ -1,10 +1,23 @@
-/*
- * Copyright (c) 2019 Red Hat, Inc. and others. All rights reserved.
+/*******************************************************************************
+ * ============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
*
- * 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
- */
+ * 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;
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
new file mode 100644
index 000000000..e91a7ac6d
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.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
new file mode 100644
index 000000000..a4fa0b410
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * ============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 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/TestPerformanceData1211.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java
new file mode 100644
index 000000000..ffd460c3c
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * ============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/TestPerformanceData1211p.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java
new file mode 100644
index 000000000..dff517de9
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * ============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/TestsCapability.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java
new file mode 100644
index 000000000..d4353d9da
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * ============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.netconf.container.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.Model12ObjectMock;
+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/mock/DataBrokerMountpointMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java
index 09e0db7d1..65bd2199c 100644
--- 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
@@ -42,6 +42,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@SuppressWarnings("deprecation")
public class DataBrokerMountpointMock implements DataBroker, BindingService {
+ ReadOnlyTransaction readOnlyTransaction;
+
+ public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) {
+ this.readOnlyTransaction = readOnlyTransaction;
+ }
+
@Override
public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
DataTreeIdentifier<T> arg0, L arg1) {
@@ -55,7 +61,7 @@ public class DataBrokerMountpointMock implements DataBroker, BindingService {
@Override
public ReadOnlyTransaction newReadOnlyTransaction() {
- return null;
+ return readOnlyTransaction;
}
@Override
@@ -74,4 +80,5 @@ public class DataBrokerMountpointMock implements DataBroker, BindingService {
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
index 77ee58729..4c4781a70 100644
--- 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
@@ -41,40 +41,42 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@SuppressWarnings("deprecation")
public class DataBrokerNetconfMock implements DataBroker {
+
+ ReadOnlyTransaction readOnlyTransaction;
+
+ public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) {
+ this.readOnlyTransaction = readOnlyTransaction;
+ }
+
@Override
public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
DataTreeIdentifier<T> arg0, L arg1) {
- // TODO Auto-generated method stub
return null;
}
@Override
public BindingTransactionChain createTransactionChain(TransactionChainListener listener) {
- // TODO Auto-generated method stub
return null;
}
@Override
public ReadOnlyTransaction newReadOnlyTransaction() {
- return new ReadOnlyTransactionMock();
+ return readOnlyTransaction;
}
@Override
public ReadWriteTransaction newReadWriteTransaction() {
- // TODO Auto-generated method stub
return null;
}
@Override
public WriteTransaction newWriteOnlyTransaction() {
- // TODO Auto-generated method stub
return null;
}
@Override
public ListenerRegistration<DataChangeListener> registerDataChangeListener(LogicalDatastoreType store,
InstanceIdentifier<?> path, DataChangeListener listener, DataChangeScope triggeringScope) {
- // TODO Auto-generated method stub
return null;
}
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
index ca63dcf71..51c33171e 100644
--- 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
@@ -24,6 +24,13 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock;
import com.google.common.base.Optional;
import org.opendaylight.controller.md.sal.binding.api.BindingService;
import org.opendaylight.controller.md.sal.binding.api.MountPoint;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+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;
/**
@@ -34,10 +41,16 @@ 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 null;
+ return NETCONF_TOPO_IID;
}
@SuppressWarnings("unchecked")
@@ -46,11 +59,19 @@ public class MountPointMock implements MountPoint {
System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent);
- Optional<?> res = Optional.absent();
+ Optional<?> res;
if (service.isInstance(dataBroker)) {
+ System.out.println("Delivering databroker");
res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker);
- } else if (service.isInstance(org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry.class)) {
- res = Optional.of(new RpcConsumerRegistryMock());
+ } 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.absent();
}
return (Optional<T>)res;
}
@@ -59,4 +80,10 @@ public class MountPointMock implements MountPoint {
this.databrokerAbsent = state;
}
+ public <T extends NotificationService&ReadOnlyTransaction>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/NotificationPublishServiceMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java
index 54408c451..91fc331f3 100644
--- 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
@@ -31,32 +31,19 @@ import org.opendaylight.yangtools.yang.binding.Notification;
*/
public class NotificationPublishServiceMock implements NotificationPublishService {
- /* (non-Javadoc)
- * @see org.opendaylight.controller.md.sal.binding.api.NotificationPublishService#offerNotification(org.opendaylight.yangtools.yang.binding.Notification)
- */
@Override
public ListenableFuture<?> offerNotification(Notification notification) {
- // TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
- * @see org.opendaylight.controller.md.sal.binding.api.NotificationPublishService#offerNotification(org.opendaylight.yangtools.yang.binding.Notification, int, java.util.concurrent.TimeUnit)
- */
- @Override
+ @Override
public ListenableFuture<?> offerNotification(Notification notification, int timeout, TimeUnit unit)
throws InterruptedException {
- // TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
- * @see org.opendaylight.controller.md.sal.binding.api.NotificationPublishService#putNotification(org.opendaylight.yangtools.yang.binding.Notification)
- */
@Override
public void putNotification(Notification notification) throws InterruptedException {
- // TODO Auto-generated method stub
-
- }
+ }
}
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ReadOnlyTransactionMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ReadOnlyTransactionMock.java
deleted file mode 100644
index 0bfe4b3eb..000000000
--- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ReadOnlyTransactionMock.java
+++ /dev/null
@@ -1,143 +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 com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-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.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.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.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * @author herbert
- *
- */
-@SuppressWarnings("deprecation")
-public class ReadOnlyTransactionMock implements ReadOnlyTransaction {
-
-
- @Override
- public Object getIdentifier() {
- return null;
- }
-
- @Override
- public <T extends DataObject> CheckedFuture<Optional<T>, ReadFailedException> read(LogicalDatastoreType store,
- InstanceIdentifier<T> path) {
-
- NetconfNodeBuilder netconfNodeBuilder = new NetconfNodeBuilder();
- netconfNodeBuilder.setConnectionStatus(ConnectionStatus.Connected);
- netconfNodeBuilder.setAvailableCapabilities(getCababilitiesList(WrapperMicrowaveModelRev181010.QNAME.toString()).build());
- NetconfNode nnode = netconfNodeBuilder.build();
- NodeBuilder nodeBuilder = new NodeBuilder();
- nodeBuilder.addAugmentation(NetconfNode.class, nnode);
- Node node = nodeBuilder.build();
- @SuppressWarnings("unchecked")
- Optional<T> res1 = (Optional<T>) Optional.of(node);
- CheckedFuture<Optional<T>, ReadFailedException> res = new CheckedFuture<Optional<T>, ReadFailedException>() {
-
- @Override
- public void addListener(Runnable arg0, Executor arg1) {
- }
-
- @Override
- public boolean cancel(boolean mayInterruptIfRunning) {
- return false;
- }
-
- @Override
- public Optional<T> get() throws InterruptedException, ExecutionException {
- return null;
- }
-
- @Override
- public Optional<T> get(long timeout, TimeUnit unit)
- throws InterruptedException, ExecutionException, TimeoutException {
- return null;
- }
-
- @Override
- public boolean isCancelled() {
- return false;
- }
-
- @Override
- public boolean isDone() {
- return false;
- }
-
- @Override
- public Optional<T> checkedGet() throws ReadFailedException {
- return res1;
- }
-
- @Override
- public Optional<T> checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException {
- return null;
- }
-
- };
-
-
- return res;
- }
-
- private AvailableCapabilitiesBuilder getCababilitiesList(String ... strings) {
- return getCababilitiesList(null, strings);
- }
-
- private AvailableCapabilitiesBuilder getCababilitiesList(AvailableCapabilitiesBuilder valueBuilder, String ... strings) {
- if (valueBuilder == null) {
- valueBuilder = new AvailableCapabilitiesBuilder();
- }
- List<AvailableCapability> capabilites = new ArrayList<>();
- for (String s : strings) {
- AvailableCapabilityBuilder capabilityBuilder = new AvailableCapabilityBuilder();
- capabilityBuilder.setCapability(s);
- capabilites.add(capabilityBuilder.build());
- }
- valueBuilder.setAvailableCapability(capabilites);
- return valueBuilder;
- }
-
- @Override
- public void close() {
- }
-
-}
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
new file mode 100644
index 000000000..156aabdcb
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * ============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.internalTypes.InternalDateAndTime;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev180907;
+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);
+
+ // 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
new file mode 100644
index 000000000..46b66aebc
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * ============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.internalTypes.InternalDateAndTime;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010;
+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);
+
+ // 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
new file mode 100644
index 000000000..9d7c0f3b0
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * ============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.internalTypes.InternalDateAndTime;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324;
+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);
+
+ // 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/ObjectBuilder.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java
new file mode 100644
index 000000000..b2faa5667
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * ============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.netconf.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
new file mode 100644
index 000000000..5dbffa3b2
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * ============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.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+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 ReadOnlyTransaction, 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> CheckedFuture<Optional<T>, ReadFailedException> read(LogicalDatastoreType store,
+ 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.absent();
+ }
+
+
+ CheckedFuture<Optional<T>, ReadFailedException> res = new CheckedFuture<Optional<T>, ReadFailedException>() {
+
+ @Override
+ public void addListener(Runnable arg0, Executor arg1) {}
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ return false;
+ }
+
+ @Override
+ public Optional<T> get() throws InterruptedException, ExecutionException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> get(long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return null;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return false;
+ }
+
+ @Override
+ public boolean isDone() {
+ return false;
+ }
+
+ @Override
+ public Optional<T> checkedGet() throws ReadFailedException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException {
+ return null;
+ }
+
+ };
+ 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
new file mode 100644
index 000000000..9b49c5b99
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * ============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.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+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 ReadOnlyTransaction, 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> CheckedFuture<Optional<T>, ReadFailedException> read(LogicalDatastoreType store,
+ 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.absent();
+ }
+
+
+ CheckedFuture<Optional<T>, ReadFailedException> res = new CheckedFuture<Optional<T>, ReadFailedException>() {
+
+ @Override
+ public void addListener(Runnable arg0, Executor arg1) {}
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ return false;
+ }
+
+ @Override
+ public Optional<T> get() throws InterruptedException, ExecutionException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> get(long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return null;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return false;
+ }
+
+ @Override
+ public boolean isDone() {
+ return false;
+ }
+
+ @Override
+ public Optional<T> checkedGet() throws ReadFailedException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException {
+ return null;
+ }
+
+ };
+ 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
new file mode 100644
index 000000000..45c0f3900
--- /dev/null
+++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * ============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.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+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
+ *
+ */
+@SuppressWarnings("deprecation")
+public class ReadOnlyTransactionMountpoint12Mock implements ReadOnlyTransaction, 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> CheckedFuture<Optional<T>, ReadFailedException> read(LogicalDatastoreType store,
+ 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.absent();
+ }
+
+
+ CheckedFuture<Optional<T>, ReadFailedException> res = new CheckedFuture<Optional<T>, ReadFailedException>() {
+
+ @Override
+ public void addListener(Runnable arg0, Executor arg1) {}
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning) {
+ return false;
+ }
+
+ @Override
+ public Optional<T> get() throws InterruptedException, ExecutionException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> get(long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ return null;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return false;
+ }
+
+ @Override
+ public boolean isDone() {
+ return false;
+ }
+
+ @Override
+ public Optional<T> checkedGet() throws ReadFailedException {
+ return res1;
+ }
+
+ @Override
+ public Optional<T> checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException {
+ return null;
+ }
+
+ };
+ 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());
+ }
+
+}