add fixes for wt sulfur 27/130527/2
authorMichael Dürre <michael.duerre@highstreet-technologies.com>
Wed, 31 Aug 2022 06:46:55 +0000 (08:46 +0200)
committerDan Timoney <dtimoney@att.com>
Wed, 31 Aug 2022 21:04:07 +0000 (21:04 +0000)
fix devmgrs and db access

Issue-ID: CCSDK-3749
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: I41018d2daa55b200a9ba89e784f8adf4200d32c3
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
33 files changed:
sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/threading/KeyBasedThreadpool.java
sdnr/wt/data-provider/dblib/pom.xml
sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/SqlDBClient.java
sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriter.java
sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java
sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java
sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java
sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java
sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java
sdnr/wt/data-provider/installer/pom.xml
sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
sdnr/wt/devicemanager-core/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java
sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/TestORanDOMToInternalDataModel.java
sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/YangParserTestUtils.java [deleted file]
sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/util/TestYangParserUtil.java [new file with mode: 0644]
sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/resources/ietf-hardware.xml
sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomAirInterfaceNotificationListener.java
sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomEthernetContainerNotificationListener.java
sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomWireInterfaceNotificationListener.java
sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/Onf14DomTestUtils.java
sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java [new file with mode: 0644]
sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/YangParserTestUtils.java [deleted file]
sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/connect/README.md
sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/README.md [deleted file]
sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/README.md [deleted file]
sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/CMNotificationClient.java
sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultNotificationClient.java
sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFMountPointClient.java
sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java
sdnr/wt/oauth-provider/provider-jar/src/main/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/providers/TokenCreator.java
sdnr/wt/oauth-provider/provider-osgi/pom.xml
sdnr/wt/websocketmanager/provider/pom.xml
sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java

index f507eec..c6bd164 100644 (file)
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
 public class KeyBasedThreadpool<T, S> implements GenericRunnableFactoryCallback<T> {
 
     private static final Logger LOG = LoggerFactory.getLogger(KeyBasedThreadpool.class);
-    private final Queue<Entry<T, S>> queue;
+    private final ConcurrentLinkedQueue<Entry<T, S>> queue;
     private final List<T> runningKeys;
     private final int keyPoolSize;
     private final GenericRunnableFactory<T, S> factory;
@@ -65,7 +65,7 @@ public class KeyBasedThreadpool<T, S> implements GenericRunnableFactoryCallback<
         LOG.info("starting key-based threadpool with keysize={} and size={}", keyPoolSize, poolSize);
     }
 
-    public void execute(T key, S arg) {
+    public synchronized void execute(T key, S arg) {
         if (this.isKeyPoolSizeReached(key)) {
             LOG.debug("pool size for key {} reached. add to queue", key);
             queue.add(new SimpleEntry<>(key, arg));
@@ -97,6 +97,9 @@ public class KeyBasedThreadpool<T, S> implements GenericRunnableFactoryCallback<
 
     private boolean isKeyPoolSizeReached(T key) {
         LOG.trace("running keys size={}", this.runningKeys.size());
+        if (this.keyPoolSize == 1) {
+            return this.runningKeys.contains(key);
+        }
         return this.runningKeys.stream().filter(e -> e == key).count() >= this.keyPoolSize;
     }
 
@@ -107,7 +110,7 @@ public class KeyBasedThreadpool<T, S> implements GenericRunnableFactoryCallback<
         this.executeNext();
     }
 
-    public void join() {
+    public synchronized void join() {
         LOG.debug("wait for all executors to finish");
         while (this.runningKeys.size() > 0 && this.queue.size() > 0) {
             try {
index 5c7294c..9ea692c 100644 (file)
             <scope>provided</scope>
         </dependency>
         <!--  MariaDB start -->
+        <dependency>
+            <groupId>com.zaxxer</groupId>
+            <artifactId>HikariCP</artifactId>
+        </dependency>
         <dependency> <!--  Not part of ODL karaf standard delivery -->
             <groupId>org.mariadb.jdbc</groupId>
             <artifactId>mariadb-java-client</artifactId>
index 1ed0b5f..b93145c 100644 (file)
@@ -30,6 +30,9 @@ import java.sql.Statement;
 import java.text.ParseException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
+import com.zaxxer.hikari.HikariDataSource;
+import org.mariadb.jdbc.MariaDbPoolDataSource;
 import org.onap.ccsdk.features.sdnr.wt.common.database.Portstatus;
 import org.onap.ccsdk.features.sdnr.wt.common.database.data.AliasesEntry;
 import org.onap.ccsdk.features.sdnr.wt.common.database.data.AliasesEntryList;
@@ -42,6 +45,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.sql.ConnectionPoolDataSource;
+
 public class SqlDBClient {
 
     private static final Logger LOG = LoggerFactory.getLogger(SqlDBClient.class);
@@ -58,11 +63,13 @@ public class SqlDBClient {
     private static final String SELECT_VERSION_QUERY = "SELECT @@version as version";
 
     private static final String DBNAME_DEFAULT = "sdnrdb";
+    private static final int DEFAULT_POOLSIZE = 50;
     private final String dbConnectionString;
     private final String dbName;
     private final String dbHost;
     private final int dbPort;
 
+    private final HikariDataSource connectionPool;
     /**
      *
      * @param dbUrl e.g. jdbc:mysql://sdnrdb:3306/sdnrdb
@@ -78,6 +85,10 @@ public class SqlDBClient {
         this.dbHost = matcher.group(2);
         this.dbPort = Integer.parseInt(matcher.group(3));
         this.dbName = matcher.group(4);
+        this.connectionPool = new HikariDataSource();
+        this.connectionPool.setJdbcUrl(this.dbConnectionString);
+        this.connectionPool.setUsername(username);
+        this.connectionPool.setPassword(password);
     }
 
     public AliasesEntryList readViews() {
index 56e965c..56a986e 100644 (file)
@@ -185,8 +185,9 @@ public class SqlDBReaderWriter<T extends DataObject> {
         }
         String insertedId = null;
         PreparedStatement stmt = null;
+        Connection connection = null;
         try {
-            Connection connection = this.dbService.getConnection();
+            connection = this.dbService.getConnection();
             stmt = connection.prepareStatement(query.toSql());
             stmt.execute();
 
@@ -208,6 +209,13 @@ public class SqlDBReaderWriter<T extends DataObject> {
                     LOG.warn("problem closing sql statement: ", e);
                 }
             }
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (SQLException e) {
+                    LOG.warn("problem closing sql connection: ", e);
+                }
+            }
         }
 
         return insertedId;
@@ -221,8 +229,9 @@ public class SqlDBReaderWriter<T extends DataObject> {
             LOG.trace("query={}", query.toSql());
         }
         PreparedStatement stmt = null;
+        Connection connection = null;
         try {
-            Connection connection = this.dbService.getConnection();
+            connection = this.dbService.getConnection();
             stmt = connection.prepareStatement(query.toSql());
             stmt.execute();
 
@@ -241,6 +250,13 @@ public class SqlDBReaderWriter<T extends DataObject> {
                     LOG.warn("problem closing sql statement: ", e);
                 }
             }
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (SQLException e) {
+                    LOG.warn("problem closing sql connection: ", e);
+                }
+            }
         }
         return insertedId;
     }
@@ -262,8 +278,9 @@ public class SqlDBReaderWriter<T extends DataObject> {
         }
         int affectedRows = 0;
         PreparedStatement stmt = null;
+        Connection connection = null;
         try {
-            Connection connection = this.dbService.getConnection();
+            connection = this.dbService.getConnection();
             stmt = connection.prepareStatement(query.toSql());
             stmt.execute();
             affectedRows = stmt.getUpdateCount();
@@ -278,6 +295,13 @@ public class SqlDBReaderWriter<T extends DataObject> {
                     LOG.warn("problem closing sql statement: ", e);
                 }
             }
+            if (connection != null) {
+                try {
+                    connection.close();
+                } catch (SQLException e) {
+                    LOG.warn("problem closing sql connection: ", e);
+                }
+            }
         }
         return affectedRows;
     }
index 75d8c9a..d98d36d 100644 (file)
@@ -61,6 +61,9 @@ public class SqlDBStatusReader {
         long minorCount = 0;
         long warningCount = 0;
         ResultSet data;
+        if(LOG.isTraceEnabled()){
+            LOG.trace("query={}", selectQuery);
+        }
         try {
             data = this.dbClient.read(selectQuery);
             String severity;
@@ -92,6 +95,9 @@ public class SqlDBStatusReader {
         long connectedCount = 0, connectingCount = 0, disconnectedCount = 0, mountedCount = 0, unableToConnectCount = 0,
                 undefinedCount = 0, unmountedCount = 0;
         long cnt;
+        if(LOG.isTraceEnabled()){
+            LOG.trace("query={}", selectQuery);
+        }
         try {
             data = this.dbClient.read(selectQuery);
             while (data.next()) {
index 65e0c54..bc888df 100644 (file)
@@ -30,7 +30,7 @@ public class RegexSqlDBFilter extends DBKeyValuePair<String> implements SqlDBFil
 
     @Override
     public String getFilterExpression() {
-        return String.format("`%s` RLIKE '%s'", this.getKey(), this.getValue());
+        return String.format("`%s` RLIKE '^%s$'", this.getKey(), this.getValue());
     }
 
     @Override
index 34c4d6f..3370304 100644 (file)
@@ -125,6 +125,7 @@ public class TestMariaDataProvider {
 
     private static final String NODEID1 = "node1";
     private static final String NODEID2 = "node2";
+    private static final String NODEID22 = "node22";
     private static final String NODEID3 = "node3";
     private static final String NODEID4 = "node4";
     private static final String NODEID5 = "node5";
@@ -140,6 +141,7 @@ public class TestMariaDataProvider {
     private static final String USERNAME = "admin";
     private static MariaDBTestBase testBase;
     private static SqlDBDataProvider dbProvider;
+    private static SqlDBDataProvider dbProviderOverall;
     private static SqlDBClient dbClient;
     private static String CONTROLLERID;
 
@@ -153,6 +155,7 @@ public class TestMariaDataProvider {
         MariaDBTestBase.testCreateTableStructure(dbClient);
         dbProvider.setControllerId();
         CONTROLLERID = dbProvider.getControllerId();
+        dbProviderOverall = testBase.getOverallDbProvider();
 
     }
 
@@ -533,19 +536,23 @@ public class TestMariaDataProvider {
         NetworkElementConnectionEntity ne2 = new NetworkElementConnectionBuilder().setNodeId(NODEID2)
                 .setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
                 .setPassword("passwd").setStatus(ConnectionLogStatus.Connecting).build();
+        NetworkElementConnectionEntity ne22 = new NetworkElementConnectionBuilder().setNodeId(NODEID22)
+                .setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
+                .setPassword("passwd").setStatus(ConnectionLogStatus.Connected).build();
         NetworkElementConnectionEntity ne3 = new NetworkElementConnectionBuilder().setNodeId(NODEID3)
                 .setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
                 .setPassword("passwd").setStatus(ConnectionLogStatus.Connecting).build();
         try {
             dbProvider.createNetworkElementConnection(ne1);
             dbProvider.createNetworkElementConnection(ne2);
+            dbProvider.createNetworkElementConnection(ne22);
             dbProvider.updateNetworkConnection22(ne3, NODEID3);
         } catch (IOException e) {
             e.printStackTrace();
             fail("problem creating neconnection");
         }
         data = dbProvider.readNetworkElementConnectionList(createInput(1, 20));
-        assertEquals(3, data.getData().size());
+        assertEquals(4, data.getData().size());
         NetworkElementConnectionEntity update1 = new NetworkElementConnectionBuilder()
                 .setStatus(ConnectionLogStatus.Connected).setDeviceType(NetworkElementDeviceType.ORAN).build();
         dbProvider.updateNetworkConnectionDeviceType(update1, NODEID1);
@@ -574,15 +581,41 @@ public class TestMariaDataProvider {
             e.printStackTrace();
             fail("failed to read status");
         }
-        assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+        assertEquals(2, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
         assertEquals(2, status.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
         assertEquals(0, status.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
         assertEquals(0, status.getData().get(0).getNetworkElementConnections().getMounted().intValue());
-        assertEquals(3, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+        assertEquals(4, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
         assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
         assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
         assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
 
+        ReadStatusOutputBuilder status2=null;
+        try {
+            EntityInput input=createInput("node-id","node2*", 1, 20);
+            status = dbProvider.readStatus(input);
+            status2 = dbProviderOverall.readStatus(input);
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("failed to read status");
+        }
+        assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+        assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
+        assertEquals(0, status.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
+        assertEquals(0, status.getData().get(0).getNetworkElementConnections().getMounted().intValue());
+        assertEquals(2, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+        assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
+        assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
+        assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
+        
+        assertEquals(1, status2.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+        assertEquals(1, status2.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
+        assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
+        assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getMounted().intValue());
+        assertEquals(2, status2.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+        assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
+        assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
+        assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
 
         DeleteNetworkElementConnectionInput delete1 =
                 new DeleteNetworkElementConnectionInputBuilder().setId(NODEID1).build();
@@ -595,7 +628,7 @@ public class TestMariaDataProvider {
         data = dbProvider.readNetworkElementConnectionList(createInput("node-id", NODEID1, 1, 20));
         assertEquals(0, data.getData().size());
         data = dbProvider.readNetworkElementConnectionList(createInput(1, 20));
-        assertEquals(2, data.getData().size());
+        assertEquals(3, data.getData().size());
 
     }
 
index 7dd2464..30c68a0 100644 (file)
@@ -224,6 +224,20 @@ public class TestQuerySyntax {
         assertTrue(query.toSql().contains(".*"));
 
     }
+    @Test
+    public void testSelectForFilterValues6() {
+        EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
+                .setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
+                        new FilterBuilder().setProperty("id").setFiltervalue("*ran*").build())))
+                .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build())
+                .build();
+        SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID);
+        System.out.println(query.toSql());
+        assertTrue(query.toSql().contains("RLIKE"));
+        assertTrue(query.toSql().contains(".*"));
+
+    }
+
     @Test
     public void testCount() {
         CountQuery query = new CountQuery(Entity.Eventlog, TestMariaDataProvider.createInput(1, 20));
index aebd332..3123d25 100644 (file)
@@ -57,6 +57,7 @@ import ch.vorburger.mariadb4j.DBConfigurationBuilder;
 public class MariaDBTestBase {
 
     private final SqlDBDataProvider dbProvider;
+    private final SqlDBDataProvider dbProviderOverall;
     private final DB db;
     private SqlDBConfig config;
     private static final Map<String, String> envDefaultValues = initEnvDefaultValues();
@@ -96,6 +97,11 @@ public class MariaDBTestBase {
         this.config.setControllerId("test123");
         this.db = null;
         this.dbProvider = new SqlDBDataProvider(config, false);
+
+        SqlDBConfig config2 = new SqlDBConfig(new ConfigurationFileRepresentation("test2.properties"));
+        config2.setDbSuffix("");
+        config2.setControllerId(null);
+        this.dbProviderOverall = new SqlDBDataProvider(config2, false);
     }
 
     public MariaDBTestBase(int port) throws ManagedProcessException {
@@ -111,6 +117,10 @@ public class MariaDBTestBase {
         this.db = startDatabase(port);
         //create db with name sdnrdb
         this.dbProvider = new SqlDBDataProvider(config, false);
+        SqlDBConfig config2 = new SqlDBConfig(new ConfigurationFileRepresentation("test2.properties"));
+        config2.setDbSuffix("");
+        config2.setControllerId(null);
+        this.dbProviderOverall = new SqlDBDataProvider(config2, false);
     }
 
     public void close() throws ManagedProcessException {
@@ -126,6 +136,9 @@ public class MariaDBTestBase {
     public SqlDBDataProvider getDbProvider() {
         return dbProvider;
     }
+    public SqlDBDataProvider getOverallDbProvider() {
+        return dbProviderOverall;
+    }
 
     public DB getDb() {
         return db;
index 123493c..a6ec2f0 100755 (executable)
             <groupId>com.highstreet-technologies.opendaylight</groupId>
             <artifactId>odl-ready</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.zaxxer</groupId>
+            <artifactId>HikariCP</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
index 6ddc092..868bf7e 100644 (file)
@@ -32,6 +32,9 @@ public class ODLVersionLUT {
         if (onapCCSDKVersion == null) {
             return def;
         }
+        if (onapCCSDKVersion.startsWith("2.5.")) {
+            return "ONAP London";
+        } 
         if (onapCCSDKVersion.startsWith("2.4.")) {
             return "ONAP Kohn";
         } 
@@ -69,6 +72,7 @@ public class ODLVersionLUT {
         }
         if(odlMdsalVersionLUT==null) {
             odlMdsalVersionLUT = new HashMap<>();
+            odlMdsalVersionLUT.put("9.0.4","sulfur-SR1 (0.16.1)");
             odlMdsalVersionLUT.put("9.0.2","sulfur-SR0 (0.16.0)");
             odlMdsalVersionLUT.put("8.0.11","phosphorus-SR2 (0.15.2)");
             odlMdsalVersionLUT.put("8.0.7","phosphorus-SR1 (0.15.1)");
index 4bad25c..e4c2b45 100644 (file)
@@ -50,7 +50,7 @@ public class TestDcae {
 
     private static final String ENABLEDDCAE_TESTCONFIG_FILENAME = "test2.properties";
     private static final File ENABLEDDCAE_TESTCONFIG_FILE = new File(ENABLEDDCAE_TESTCONFIG_FILENAME);
-    private static final int DCAE_SERVER_PORT = 45451;
+    private static final int DCAE_SERVER_PORT = 45452;
     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"
index e3113db..b2c6698 100644 (file)
@@ -34,6 +34,7 @@ import javax.xml.stream.XMLStreamReader;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom.util.TestYangParserUtil;
 import org.opendaylight.mdsal.dom.api.DOMEvent;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
@@ -79,7 +80,7 @@ public class TestORanDOMToInternalDataModel {
 
     @BeforeClass
     public static void setup() throws IOException {
-        schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
+        schemaContext = TestYangParserUtil.parseYangResourceDirectory("/");
         hwContainerSchema = Inference.ofDataTreePath(schemaContext, HW_CONTAINER);
         systemSchema = Inference.ofDataTreePath(schemaContext, IETF_CONTAINER);
     }
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/YangParserTestUtils.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/YangParserTestUtils.java
deleted file mode 100644 (file)
index 80c18ae..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.dom;
-
-import com.google.common.annotations.Beta;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.parser.api.YangParser;
-import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
-import org.opendaylight.yangtools.yang.parser.api.YangParserException;
-import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
-import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Utility class which provides convenience methods for producing effective schema context based on the supplied
- * yang/yin sources or paths to these sources.
- */
-@Beta
-public final class YangParserTestUtils {
-
-    private static final FileFilter YANG_FILE_FILTER = file -> {
-        // Locale keeps SpotBugs happy. It should not matter that much anyway.
-        final String name = file.getName().toLowerCase(Locale.ENGLISH);
-        return name.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION) && file.isFile();
-    };
-
-    private static final @NonNull YangParserFactory PARSER_FACTORY;
-
-    static {
-        final Iterator<@NonNull YangParserFactory> it = ServiceLoader.load(YangParserFactory.class).iterator();
-        if (!it.hasNext()) {
-            throw new IllegalStateException("No YangParserFactory found");
-        }
-        PARSER_FACTORY = it.next();
-    }
-
-    private YangParserTestUtils() {
-        // Hidden on purpose
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     *
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource) {
-        return parseYangResource(resource, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. All YANG features are supported.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final YangParserConfiguration config) {
-        return parseYangResource(resource, config, null);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
-     * default mode.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          model are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final Set<QName> supportedFeatures) {
-        return parseYangResource(resource, YangParserConfiguration.DEFAULT, supportedFeatures);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          model are resolved
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final YangParserConfiguration config,
-            final Set<QName> supportedFeatures) {
-        final YangTextSchemaSource source = YangTextSchemaSource.forResource(YangParserTestUtils.class, resource);
-        return parseYangSources(config, supportedFeatures, source);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final File... files) {
-        return parseYangFiles(Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param files collection of YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Collection<File> files) {
-        return parseYangFiles(YangParserConfiguration.DEFAULT, files);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures, final File... files) {
-        return parseYangFiles(supportedFeatures, Arrays.asList(files));
-    }
-
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-            final Collection<File> files) {
-        return parseYangFiles(supportedFeatures, YangParserConfiguration.DEFAULT, files);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config, final File... files) {
-        return parseYangFiles(config, Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param parserMode mode of statement parser
-     * @param files collection of YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config,
-            final Collection<File> files) {
-        return parseYangFiles(null, config, files);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-               final YangParserConfiguration config, final File... files) {
-        return parseYangFiles(supportedFeatures, config, Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-               final YangParserConfiguration config, final Collection<File> files) {
-        return parseSources(config, supportedFeatures,
-            files.stream().map(e->e.toPath()).map(YangTextSchemaSource::forPath).collect(Collectors.toList()));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath) {
-        return parseYangResourceDirectory(resourcePath, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-               final YangParserConfiguration config) {
-        return parseYangResourceDirectory(resourcePath, null, config);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-            final Set<QName> supportedFeatures) {
-        return parseYangResourceDirectory(resourcePath, supportedFeatures, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Wrong inferent on listFiles")
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-            final Set<QName> supportedFeatures, final YangParserConfiguration config) {
-        final URI directoryPath;
-        try {
-            directoryPath = YangParserTestUtils.class.getResource(resourcePath).toURI();
-        } catch (URISyntaxException e) {
-            throw new IllegalArgumentException("Failed to open resource " + resourcePath, e);
-        }
-        return parseYangFiles(supportedFeatures, config, new File(directoryPath).listFiles(YANG_FILE_FILTER));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param clazz Resource lookup base
-     * @param resources Resource names to be looked up
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final Class<?> clazz, final String... resources) {
-        return parseYangResources(clazz, Arrays.asList(resources));
-    }
-
-    public static EffectiveModelContext parseYangResources(final Class<?> clazz, final Collection<String> resources) {
-        final List<YangTextSchemaSource> sources = new ArrayList<>(resources.size());
-        for (final String r : resources) {
-            sources.add(YangTextSchemaSource.forResource(clazz, r));
-        }
-        return parseSources(YangParserConfiguration.DEFAULT, null, sources);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param yangDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangFiles relative paths to the YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangDirs, final List<String> yangFiles,
-            final Set<QName> supportedFeatures) {
-        return parseYangResources(yangDirs, yangFiles, supportedFeatures, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangResources relative paths to the YANG files to be parsed
-     * @param statementParserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangResourceDirs,
-            final List<String> yangResources, final YangParserConfiguration config) {
-        return parseYangResources(yangResourceDirs, yangResources, null, config);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangResources relative paths to the YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param statementParserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangResourceDirs,
-            final List<String> yangResources, final Set<QName> supportedFeatures,
-            final YangParserConfiguration config) {
-        final List<File> allYangFiles = new ArrayList<>();
-        for (final String yangDir : yangResourceDirs) {
-            allYangFiles.addAll(getYangFiles(yangDir));
-        }
-
-        for (final String yangFile : yangResources) {
-            try {
-                allYangFiles.add(new File(YangParserTestUtils.class.getResource(yangFile).toURI()));
-            } catch (URISyntaxException e) {
-                throw new IllegalArgumentException("Invalid resource " + yangFile, e);
-            }
-        }
-
-        return parseYangFiles(supportedFeatures, config, allYangFiles);
-    }
-
-    public static EffectiveModelContext parseYangSources(final YangParserConfiguration config,
-            final Set<QName> supportedFeatures, final YangTextSchemaSource... sources) {
-        return parseSources(config, supportedFeatures, Arrays.asList(sources));
-    }
-
-    public static EffectiveModelContext parseSources(final YangParserConfiguration config,
-            final Set<QName> supportedFeatures, final Collection<? extends SchemaSourceRepresentation> sources) {
-        final YangParser parser = PARSER_FACTORY.createParser(config);
-        if (supportedFeatures != null) {
-            parser.setSupportedFeatures(supportedFeatures);
-        }
-
-        try {
-            parser.addSources(sources);
-        } catch (YangSyntaxErrorException e) {
-            throw new IllegalArgumentException("Malformed source", e);
-        } catch (IOException e) {
-            throw new IllegalArgumentException("Failed to read a source", e);
-        }
-
-        try {
-            return parser.buildEffectiveModel();
-        } catch (YangParserException e) {
-            throw new IllegalStateException("Failed to assemble SchemaContext", e);
-        }
-    }
-
-    @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Wrong inferent on listFiles")
-    private static Collection<File> getYangFiles(final String resourcePath) {
-        final URI directoryPath;
-        try {
-            directoryPath = YangParserTestUtils.class.getResource(resourcePath).toURI();
-        } catch (URISyntaxException e) {
-            throw new IllegalArgumentException("Failed to open resource directory " + resourcePath, e);
-        }
-        return Arrays.asList(new File(directoryPath).listFiles(YANG_FILE_FILTER));
-    }
-}
diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/util/TestYangParserUtil.java b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/oran/impl/dom/util/TestYangParserUtil.java
new file mode 100644 (file)
index 0000000..611d181
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2022 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.oran.impl.dom.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.YangConstants;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.parser.api.YangParser;
+import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
+
+public final class TestYangParserUtil {
+
+       private static final FileFilter YANG_FILE_FILTER = file -> {
+               final String name = file.getName();
+               return name.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION) && file.isFile();
+       };
+
+       private static final @NonNull YangParserFactory PARSER_FACTORY;
+
+       static {
+               final Iterator<@NonNull YangParserFactory> it = ServiceLoader.load(YangParserFactory.class).iterator();
+               if (!it.hasNext()) {
+                       throw new IllegalStateException("No YangParserFactory found");
+               }
+               PARSER_FACTORY = it.next();
+       }
+
+       public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config, final File... files) {
+               return parseYangFiles(config, Arrays.asList(files));
+       }
+       public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config,
+                       final Collection<File> files) {
+               return parseYangFiles(null, config, files.stream().map(e->e.toPath()).collect(Collectors.toList()));
+       }
+
+       public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
+                       final YangParserConfiguration config, final Collection<Path> files) {
+               return parseSources(config, supportedFeatures,
+                               files.stream().map(YangTextSchemaSource::forPath).collect(Collectors.toList()));
+       }
+
+
+       public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath) {
+               return parseYangResourceDirectory(resourcePath, YangParserConfiguration.DEFAULT);
+       }
+
+       public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
+                       final YangParserConfiguration config) {
+               final URI directoryPath;
+               try {
+                       directoryPath = TestYangParserUtil.class.getResource(resourcePath).toURI();
+               } catch (URISyntaxException e) {
+                       throw new IllegalArgumentException("Failed to open resource " + resourcePath, e);
+               }
+               return parseYangFiles(config, new File(directoryPath).listFiles(YANG_FILE_FILTER));
+       }
+
+
+       public static EffectiveModelContext parseSources(final YangParserConfiguration config,
+                       final Set<QName> supportedFeatures, final Collection<? extends SchemaSourceRepresentation> sources) {
+               final YangParser parser = PARSER_FACTORY.createParser(config);
+               if (supportedFeatures != null) {
+                       parser.setSupportedFeatures(supportedFeatures);
+               }
+
+               try {
+                       parser.addSources(sources);
+               } catch (YangSyntaxErrorException e) {
+                       throw new IllegalArgumentException("Malformed source", e);
+               } catch (IOException e) {
+                       throw new IllegalArgumentException("Failed to read a source", e);
+               }
+
+               try {
+                       return parser.buildEffectiveModel();
+               } catch (YangParserException e) {
+                       throw new IllegalStateException("Failed to assemble SchemaContext", e);
+               }
+       }
+
+}
index 60f9986..433c51c 100644 (file)
@@ -8,10 +8,10 @@
             <admin-state>unlocked</admin-state>
             <oper-state>enabled</oper-state>
         </state>
-        <serial-num>10283</serial-num>
-        <software-rev>3.8.1 (2020-10-30 11:47:59)</software-rev>
-        <mfg-name>ISCO</mfg-name>
-        <model-name>ProteusCPRI Compact</model-name>
+        <serial-num>1234</serial-num>
+        <software-rev>1.2.3 (2022-10-30 09:34:59)</software-rev>
+        <mfg-name>Highstreet</mfg-name>
+        <model-name>HS O-RU</model-name>
         <description>HighStreet-ONAP40</description>
         <contains-child>chassis-temperature-exhaust</contains-child>
         <contains-child>chassis-temperature-inlet</contains-child>
@@ -36,7 +36,7 @@
         <sensor-data>
             <value>30</value>
             <value-type>celsius</value-type>
-            <value-timestamp>2021-03-18T19:51:50.3Z</value-timestamp>
+            <value-timestamp>2022-03-18T19:51:50.3Z</value-timestamp>
             <oper-status>ok</oper-status>
         </sensor-data>
     </component>
@@ -53,7 +53,7 @@
         <sensor-data>
             <value>29</value>
             <value-type>celsius</value-type>
-            <value-timestamp>2021-03-18T19:51:50.3Z</value-timestamp>
+            <value-timestamp>2022-03-18T19:51:50.3Z</value-timestamp>
             <oper-status>ok</oper-status>
         </sensor-data>
     </component>
@@ -82,7 +82,7 @@
         <sensor-data>
             <value>4100</value>
             <value-type>rpm</value-type>
-            <value-timestamp>2021-03-18T19:51:50.3Z</value-timestamp>
+            <value-timestamp>2022-03-18T19:51:50.3Z</value-timestamp>
             <oper-status>ok</oper-status>
         </sensor-data>
     </component>
         </state>
         <parent>chassis</parent>
         <parent-rel-pos>7</parent-rel-pos>
-        <serial-num>7220530</serial-num>
-        <firmware-rev>12.00.42-S (0F7F1001)</firmware-rev>
+        <serial-num>1020304050</serial-num>
+        <firmware-rev>123456 (0ABC56D1)</firmware-rev>
         <software-rev>0</software-rev>
-        <model-name>385A-SFP-2P-40-FHL-JC3</model-name>
+        <model-name>00AA-SFP-99-BB-CCC</model-name>
         <contains-child>slot0-temperature</contains-child>
         <contains-child>slot0-logical0</contains-child>
         <contains-child>slot0-logical1</contains-child>
         <parent>slot0-logical0</parent>
         <parent-rel-pos>0</parent-rel-pos>
         <o-ran-name xmlns="urn:o-ran:hardware:1.0">slot0-logical0-bbu</o-ran-name>
-        <serial-num>AYR3GA2</serial-num>
-        <mfg-name>FINISAR CORP.</mfg-name>
-        <model-name>FTLX1475D3BTL-E7</model-name>
+        <serial-num>ABC12DF3</serial-num>
+        <mfg-name>Highstreet</mfg-name>
+        <model-name>HS-99-56</model-name>
         <contains-child>slot0-logical0-bbu-temperature</contains-child>
     </component>
     <component>
         <parent>slot0-logical0</parent>
         <parent-rel-pos>1</parent-rel-pos>
         <o-ran-name xmlns="urn:o-ran:hardware:1.0">slot0-logical0-rrh</o-ran-name>
-        <serial-num>AYR3GA9</serial-num>
-        <mfg-name>FINISAR CORP.</mfg-name>
-        <model-name>FTLX1475D3BTL-E7</model-name>
+        <serial-num>ABC78YZ</serial-num>
+        <mfg-name>Highstreet</mfg-name>
+        <model-name>2W3E4R5T6Y</model-name>
         <contains-child>slot0-logical0-rrh-temperature</contains-child>
     </component>
     <component>
         </state>
         <parent>chassis</parent>
         <parent-rel-pos>9</parent-rel-pos>
-        <serial-num>7220718</serial-num>
-        <firmware-rev>12.00.42-S (0F7F1001)</firmware-rev>
+        <serial-num>23561289</serial-num>
+        <firmware-rev>12.00.42-S (0ABC45HJ)</firmware-rev>
         <software-rev>0</software-rev>
-        <model-name>385A-SFP-2P-40-FHL-JC3</model-name>
+        <model-name>ABC-123-DEF-XYZ</model-name>
         <mfg-date>2021-10-12T14:41:55.234Z</mfg-date>
         <contains-child>slot2-temperature</contains-child>
         <contains-child>slot2-logical0</contains-child>
index f72158e..c510a1a 100644 (file)
@@ -54,6 +54,7 @@ public class Onf14DomAirInterfaceNotificationListener implements DOMNotification
 
     @Override
     public void onNotification(@NonNull DOMNotification domNotification) {
+        log.debug("Got event of type :: {}", domNotification.getType());
         if (domNotification.getType()
                 .equals(Absolute.of(Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_CREATE_NOTIFICATION))) {
             onObjectCreateNotification(domNotification);
@@ -140,6 +141,7 @@ public class Onf14DomAirInterfaceNotificationListener implements DOMNotification
                 Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION,
                 new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn,
                         Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP)));
+        log.debug("onObjectProblemNotification log entry written");
     }
 
     private void onObjectDeletionNotification(@NonNull DOMNotification domNotification) {
index 218ece4..5aa069e 100644 (file)
@@ -98,7 +98,7 @@ public class Onf14DomEthernetContainerNotificationListener implements DOMNotific
                         new DateAndTime(cn.childByArg(new NodeIdentifier(
                                 Onf14DevicemanagerQNames.ETHERNET_CONTAINER_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP))
                                 .body().toString()));
-
+        log.debug("onProblemNotification log entry written");
     }
 
     public void onAttributeValueChangedNotification(DOMNotification notification) {
index 5d148d3..401fbbe 100644 (file)
@@ -92,7 +92,7 @@ public class Onf14DomWireInterfaceNotificationListener implements DOMNotificatio
                 Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION,
                 new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn,
                         Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP)));
-
+        log.debug("onProblemNotification log entry written");
     }
 
     public void onAttributeValueChangedNotification(DOMNotification notification) {
index 6dc9b50..ad79a5c 100644 (file)
@@ -82,7 +82,7 @@ public class Onf14DomTestUtils {
 
 
     public static NormalizedNode getNormalizedNodeFromJson() throws IOException, URISyntaxException {
-        schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
+        schemaContext = TestYangParserUtil.parseYangResourceDirectory("/");
         lhotkaCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(schemaContext);
         streamAsString =
                 loadTextFile(new File(Onf14DomTestUtils.class.getResource("/ControlConstruct-data-test.json").toURI()));
@@ -105,7 +105,7 @@ public class Onf14DomTestUtils {
 
     public static NormalizedNode getNormalizedNodeFromXML()
             throws XMLStreamException, URISyntaxException, IOException, SAXException {
-        schemaContext = YangParserTestUtils.parseYangResourceDirectory("/");
+        schemaContext = TestYangParserUtil.parseYangResourceDirectory("/");
         hwContainerSchema = Inference.ofDataTreePath(schemaContext, CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER);
         final InputStream resourceAsStream =
                 Onf14DomTestUtils.class.getResourceAsStream("/ControlConstruct-data-test.xml");
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java
new file mode 100644 (file)
index 0000000..004f08d
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2022 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.onf14.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.YangConstants;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.parser.api.YangParser;
+import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
+
+public final class TestYangParserUtil {
+
+       private static final FileFilter YANG_FILE_FILTER = file -> {
+               final String name = file.getName();
+               return name.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION) && file.isFile();
+       };
+
+       private static final @NonNull YangParserFactory PARSER_FACTORY;
+
+       static {
+               final Iterator<@NonNull YangParserFactory> it = ServiceLoader.load(YangParserFactory.class).iterator();
+               if (!it.hasNext()) {
+                       throw new IllegalStateException("No YangParserFactory found");
+               }
+               PARSER_FACTORY = it.next();
+       }
+
+       public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config, final File... files) {
+               return parseYangFiles(config, Arrays.asList(files));
+       }
+       public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config,
+                       final Collection<File> files) {
+               return parseYangFiles(null, config, files.stream().map(e->e.toPath()).collect(Collectors.toList()));
+       }
+
+       public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
+                       final YangParserConfiguration config, final Collection<Path> files) {
+               return parseSources(config, supportedFeatures,
+                               files.stream().map(YangTextSchemaSource::forPath).collect(Collectors.toList()));
+       }
+
+
+       public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath) {
+               return parseYangResourceDirectory(resourcePath, YangParserConfiguration.DEFAULT);
+       }
+
+       public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
+                       final YangParserConfiguration config) {
+               final URI directoryPath;
+               try {
+                       directoryPath = TestYangParserUtil.class.getResource(resourcePath).toURI();
+               } catch (URISyntaxException e) {
+                       throw new IllegalArgumentException("Failed to open resource " + resourcePath, e);
+               }
+               return parseYangFiles(config, new File(directoryPath).listFiles(YANG_FILE_FILTER));
+       }
+
+
+       public static EffectiveModelContext parseSources(final YangParserConfiguration config,
+                       final Set<QName> supportedFeatures, final Collection<? extends SchemaSourceRepresentation> sources) {
+               final YangParser parser = PARSER_FACTORY.createParser(config);
+               if (supportedFeatures != null) {
+                       parser.setSupportedFeatures(supportedFeatures);
+               }
+
+               try {
+                       parser.addSources(sources);
+               } catch (YangSyntaxErrorException e) {
+                       throw new IllegalArgumentException("Malformed source", e);
+               } catch (IOException e) {
+                       throw new IllegalArgumentException("Failed to read a source", e);
+               }
+
+               try {
+                       return parser.buildEffectiveModel();
+               } catch (YangParserException e) {
+                       throw new IllegalStateException("Failed to assemble SchemaContext", e);
+               }
+       }
+
+}
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/YangParserTestUtils.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/YangParserTestUtils.java
deleted file mode 100644 (file)
index ee20dcc..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.util;
-
-import com.google.common.annotations.Beta;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.parser.api.YangParser;
-import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
-import org.opendaylight.yangtools.yang.parser.api.YangParserException;
-import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
-import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Utility class which provides convenience methods for producing effective schema context based on the supplied
- * yang/yin sources or paths to these sources.
- */
-@Beta
-public final class YangParserTestUtils {
-
-    private static final FileFilter YANG_FILE_FILTER = file -> {
-        // Locale keeps SpotBugs happy. It should not matter that much anyway.
-        final String name = file.getName().toLowerCase(Locale.ENGLISH);
-        return name.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION) && file.isFile();
-    };
-
-    private static final @NonNull YangParserFactory PARSER_FACTORY;
-
-    static {
-        final Iterator<@NonNull YangParserFactory> it = ServiceLoader.load(YangParserFactory.class).iterator();
-        if (!it.hasNext()) {
-            throw new IllegalStateException("No YangParserFactory found");
-        }
-        PARSER_FACTORY = it.next();
-    }
-
-    private YangParserTestUtils() {
-        // Hidden on purpose
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     *
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource) {
-        return parseYangResource(resource, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. All YANG features are supported.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final YangParserConfiguration config) {
-        return parseYangResource(resource, config, null);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
-     * default mode.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          model are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final Set<QName> supportedFeatures) {
-        return parseYangResource(resource, YangParserConfiguration.DEFAULT, supportedFeatures);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG source.
-     *
-     * @param resource relative path to the YANG file to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          model are resolved
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResource(final String resource, final YangParserConfiguration config,
-            final Set<QName> supportedFeatures) {
-        final YangTextSchemaSource source = YangTextSchemaSource.forResource(YangParserTestUtils.class, resource);
-        return parseYangSources(config, supportedFeatures, source);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final File... files) {
-        return parseYangFiles(Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param files collection of YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Collection<File> files) {
-        return parseYangFiles(YangParserConfiguration.DEFAULT, files);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures, final File... files) {
-        return parseYangFiles(supportedFeatures, Arrays.asList(files));
-    }
-
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-            final Collection<File> files) {
-        return parseYangFiles(supportedFeatures, YangParserConfiguration.DEFAULT, files.stream().map(e->e.toPath()).collect(Collectors.toList()));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config, final File... files) {
-        return parseYangFiles(config, Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param parserMode mode of statement parser
-     * @param files collection of YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final YangParserConfiguration config,
-            final Collection<File> files) {
-        return parseYangFiles(null, config, files.stream().map(e->e.toPath()).collect(Collectors.toList()));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-               final YangParserConfiguration config, final Path... files) {
-        return parseYangFiles(supportedFeatures, config, Arrays.asList(files));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @param files YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangFiles(final Set<QName> supportedFeatures,
-               final YangParserConfiguration config, final Collection<Path> files) {
-        return parseSources(config, supportedFeatures,
-            files.stream().map(YangTextSchemaSource::forPath).collect(Collectors.toList()));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath) {
-        return parseYangResourceDirectory(resourcePath, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-               final YangParserConfiguration config) {
-        return parseYangResourceDirectory(resourcePath, null, config);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-            final Set<QName> supportedFeatures) {
-        return parseYangResourceDirectory(resourcePath, supportedFeatures, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param resourcePath relative path to the directory with YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param parserMode mode of statement parser
-     * @return effective schema context
-     */
-    @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Wrong inferent on listFiles")
-    public static EffectiveModelContext parseYangResourceDirectory(final String resourcePath,
-            final Set<QName> supportedFeatures, final YangParserConfiguration config) {
-        final URI directoryPath;
-        try {
-            directoryPath = YangParserTestUtils.class.getResource(resourcePath).toURI();
-        } catch (URISyntaxException e) {
-            throw new IllegalArgumentException("Failed to open resource " + resourcePath, e);
-        }
-        File[] files = new File(directoryPath).listFiles(YANG_FILE_FILTER);
-        return parseYangFiles(supportedFeatures, config, Arrays.asList(files).stream().map(e->e.toPath()).collect(Collectors.toList()));
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode and all YANG features are supported.
-     *
-     * @param clazz Resource lookup base
-     * @param resources Resource names to be looked up
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final Class<?> clazz, final String... resources) {
-        return parseYangResources(clazz, Arrays.asList(resources));
-    }
-
-    public static EffectiveModelContext parseYangResources(final Class<?> clazz, final Collection<String> resources) {
-        final List<YangTextSchemaSource> sources = new ArrayList<>(resources.size());
-        for (final String r : resources) {
-            sources.add(YangTextSchemaSource.forResource(clazz, r));
-        }
-        return parseSources(YangParserConfiguration.DEFAULT, null, sources);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
-     * default mode.
-     *
-     * @param yangDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangFiles relative paths to the YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangDirs, final List<String> yangFiles,
-            final Set<QName> supportedFeatures) {
-        return parseYangResources(yangDirs, yangFiles, supportedFeatures, YangParserConfiguration.DEFAULT);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
-     *
-     * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangResources relative paths to the YANG files to be parsed
-     * @param statementParserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangResourceDirs,
-            final List<String> yangResources, final YangParserConfiguration config) {
-        return parseYangResources(yangResourceDirs, yangResources, null, config);
-    }
-
-    /**
-     * Creates a new effective schema context containing the specified YANG sources.
-     *
-     * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
-     * @param yangResources relative paths to the YANG files to be parsed
-     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
-     *                          models are resolved
-     * @param statementParserMode mode of statement parser
-     * @return effective schema context
-     */
-    public static EffectiveModelContext parseYangResources(final List<String> yangResourceDirs,
-            final List<String> yangResources, final Set<QName> supportedFeatures,
-            final YangParserConfiguration config) {
-        final List<File> allYangFiles = new ArrayList<>();
-        for (final String yangDir : yangResourceDirs) {
-            allYangFiles.addAll(getYangFiles(yangDir));
-        }
-
-        for (final String yangFile : yangResources) {
-            try {
-                allYangFiles.add(new File(YangParserTestUtils.class.getResource(yangFile).toURI()));
-            } catch (URISyntaxException e) {
-                throw new IllegalArgumentException("Invalid resource " + yangFile, e);
-            }
-        }
-
-        return parseYangFiles(supportedFeatures, config, allYangFiles.stream().map(e->e.toPath()).collect(Collectors.toList()));
-    }
-
-    public static EffectiveModelContext parseYangSources(final YangParserConfiguration config,
-            final Set<QName> supportedFeatures, final YangTextSchemaSource... sources) {
-        return parseSources(config, supportedFeatures, Arrays.asList(sources));
-    }
-
-    public static EffectiveModelContext parseSources(final YangParserConfiguration config,
-            final Set<QName> supportedFeatures, final Collection<? extends SchemaSourceRepresentation> sources) {
-        final YangParser parser = PARSER_FACTORY.createParser(config);
-        if (supportedFeatures != null) {
-            parser.setSupportedFeatures(supportedFeatures);
-        }
-
-        try {
-            parser.addSources(sources);
-        } catch (YangSyntaxErrorException e) {
-            throw new IllegalArgumentException("Malformed source", e);
-        } catch (IOException e) {
-            throw new IllegalArgumentException("Failed to read a source", e);
-        }
-
-        try {
-            return parser.buildEffectiveModel();
-        } catch (YangParserException e) {
-            throw new IllegalStateException("Failed to assemble SchemaContext", e);
-        }
-    }
-
-    @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Wrong inferent on listFiles")
-    private static Collection<File> getYangFiles(final String resourcePath) {
-        final URI directoryPath;
-        try {
-            directoryPath = YangParserTestUtils.class.getResource(resourcePath).toURI();
-        } catch (URISyntaxException e) {
-            throw new IllegalArgumentException("Failed to open resource directory " + resourcePath, e);
-        }
-        return Arrays.asList(new File(directoryPath).listFiles(YANG_FILE_FILTER));
-    }
-}
index ac5bbe4..584fcdf 100644 (file)
@@ -1,20 +1,19 @@
 # Connect
 
-The 'Connect' application on OpenDaylight provides up-to-date connectivity information about the wireless devices in the network. It automatically displays new Network Elements and their connection status. Usually, the Network Elements mount themselves. If necessary, they can be mounted manually by right-clicking on the element and selecting the 'mount' action. For better understanding of alarms and status, a connection status log lists all the connection status changes of OpenDaylight mount points.
+The 'Connect' application on OpenDaylight provides up-to-date connectivity information about the network nodes exposing a NETCONF/YANG interface. It automatically displays new Nodes and their connection status. Usually, the NETCONF servers of the Nodes mount themselves. If necessary, they can be mounted manually by right-clicking on the row representing a node and selecting the 'mount' action. For better understanding of alarms and status, a connection status log lists all the connection status changes of OpenDaylight mount points.
 
 ## Views
 
 The graphical user interface is divided into two sections.
 
-### Network Elements
+### Nodes
 
-Network Elements are physical network functions (PNFs). A table view shows all configured and connected NetConf Servers of the SDN-R cluster. This view also allows to manually configure/mount a device via the '+' button. The SDN controller will start connecting to the NetConf server.
+Nodes are network functions with a NETCONF/YANG management and control interface. A table view shows all configured and connected NETCONF Servers of the SDN-R cluster. This view also allows to manually configure/mount a node via the '+' button. The SDN controller will start connecting to the NETCONF server.
 
-Network Elements can be marked as 'required'. If an element is required, it will stay available even if disconnected. If an element is not required, it will be deleted once disconnected.
-
-By right-clicking on an element, an action menu opens. The menu allows to mount, unmount, view the details, edit and remove the element. Additionally, it links to several applications like [Fault](pnfFault.html) and [Configure](pnfConfig.html), which will be filtered to display information relevant to the selected element.
+Nodes can be marked as 'required'. If a node is required, it will stay available even if disconnected. If a node is not required, it will be deleted once disconnected.
 
+By right-clicking on a row representing a node, an action menu opens. The menu allows to mount, unmount, view the details, edit and remove the node. Additionally, it links to several applications like Fault and Configure, which will be filtered to display information relevant to the selected node.
 
 ### Connection Status Log
 
-The log lists the connection status changes between SDN Controller and NetConf servers (devices).
+The log lists the connection status changes between SDN Controller and NETCONF servers (devices, Network Elements, network functions).
\ No newline at end of file
diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnLog/README.md
deleted file mode 100644 (file)
index 85de8a3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Log
-
-The application displays (UX) application logs. SDN-R offer a common log server, so that PNFs or other ONAP components could log there data in a common way.
\ No newline at end of file
diff --git a/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/README.md b/sdnr/wt/helpserver/provider/src/main/resources/help/sdnr/mwtnTest/README.md
deleted file mode 100644 (file)
index 6bd3609..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Test
-
-The view offers in a generic way data fetched from ONF-TR-532 devices for test and debug purposes. 
\ No newline at end of file
index b13d4ea..115f0f0 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Map;
 
 public class CMNotificationClient extends MessageClient {
 
-    private static final String CM_NOTIFICATION_URI = "restconf/operations/devicemanager:push-cm-notification";
+    private static final String CM_NOTIFICATION_URI = "rests/operations/devicemanager:push-cm-notification";
     public static final String NODE_ID = "@node-id@", COUNTER = "@counter@", TIMESTAMP = "@timestamp@",
         OBJECT_ID = "@object-id@", NOTIFICATION_TYPE = "@notification-type@", SOURCE_INDICATOR = "@source-indicator@",
         NOTIFICATION_ID = "@notification-id@", PATH = "@path@", OPERATION = "@operation@", VALUE = "@value@";
@@ -35,17 +35,17 @@ public class CMNotificationClient extends MessageClient {
             OPERATION, VALUE);
 
     private static final String CM_PAYLOAD = "{\n"
-        + "  \"devicemanager:input\": {\n"
-        + "    \"devicemanager:node-id\": \"" + NODE_ID + "\",\n"
-        + "    \"devicemanager:counter\": \"" + COUNTER + "\",\n"
-        + "    \"devicemanager:timestamp\": \"" + TIMESTAMP + "\",\n"
-        + "    \"devicemanager:object-id\": \"" + OBJECT_ID + "\",\n"
-        + "    \"devicemanager:notification-type\": \"" + NOTIFICATION_TYPE + "\",\n"
-        + "    \"devicemanager:notification-id\": \"" + NOTIFICATION_ID + "\",\n"
-        + "    \"devicemanager:source-indicator\": \"" + SOURCE_INDICATOR + "\",\n"
-        + "    \"devicemanager:path\": \"" + PATH + "\",\n"
-        + "    \"devicemanager:operation\": \"" + OPERATION + "\",\n"
-        + "    \"devicemanager:value\": \"" + VALUE + "\"\n"
+        + "  \"input\": {\n"
+        + "    \"node-id\": \"" + NODE_ID + "\",\n"
+        + "    \"counter\": \"" + COUNTER + "\",\n"
+        + "    \"timestamp\": \"" + TIMESTAMP + "\",\n"
+        + "    \"object-id\": \"" + OBJECT_ID + "\",\n"
+        + "    \"notification-type\": \"" + NOTIFICATION_TYPE + "\",\n"
+        + "    \"notification-id\": \"" + NOTIFICATION_ID + "\",\n"
+        + "    \"source-indicator\": \"" + SOURCE_INDICATOR + "\",\n"
+        + "    \"path\": \"" + PATH + "\",\n"
+        + "    \"operation\": \"" + OPERATION + "\",\n"
+        + "    \"value\": \"" + VALUE + "\"\n"
         + "  }\n"
         + "}";
 
index 6851475..ce25386 100644 (file)
@@ -29,19 +29,19 @@ import static org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.MessageCl
 
 public class FaultNotificationClient extends MessageClient {
 
-    private static final String FAULT_NOTIFICATION_URI = "restconf/operations/devicemanager:push-fault-notification";
+    private static final String FAULT_NOTIFICATION_URI = "rests/operations/devicemanager:push-fault-notification";
     public static final String NODE_ID = "@node-id@", COUNTER = "@counter@", TIMESTAMP = "@timestamp@",
             OBJECT_ID = "@object-id@", PROBLEM = "@problem@", SEVERITY = "@severity@";
     public static final List<String> REQUIRED_FIELDS = List.of(NODE_ID, COUNTER, TIMESTAMP, OBJECT_ID, PROBLEM, SEVERITY);
 
     private static final String FAULT_PAYLOAD = "{\n"
-            + "  \"devicemanager:input\": {\n"
-            + "    \"devicemanager:node-id\": \"" + NODE_ID + "\",\n"
-            + "    \"devicemanager:counter\": \"" + COUNTER + "\",\n"
-            + "    \"devicemanager:timestamp\": \"" + TIMESTAMP + "\",\n"
-            + "    \"devicemanager:object-id\": \"" + OBJECT_ID + "\",\n"
-            + "    \"devicemanager:problem\": \"" + PROBLEM + "\",\n"
-            + "    \"devicemanager:severity\": \"" + SEVERITY + "\"\n"
+            + "  \"input\": {\n"
+            + "    \"node-id\": \"" + NODE_ID + "\",\n"
+            + "    \"counter\": \"" + COUNTER + "\",\n"
+            + "    \"timestamp\": \"" + TIMESTAMP + "\",\n"
+            + "    \"object-id\": \"" + OBJECT_ID + "\",\n"
+            + "    \"problem\": \"" + PROBLEM + "\",\n"
+            + "    \"severity\": \"" + SEVERITY + "\"\n"
             + "  }\n"
             + "}";
 
index 169e43c..fd31a3f 100644 (file)
@@ -30,7 +30,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.requests.BaseRequest;
 public class PNFMountPointClient extends MessageClient {
 
     private static final String MOUNTPOINT_URI =
-            "restconf/config/network-topology:network-topology/topology/topology-netconf/node/";
+            "rests/data/network-topology:network-topology/topology=topology-netconf/node=";
     public static final String DEVICE_NAME = "@device-name@", DEVICE_IP = "@device-ip@", DEVICE_PORT = "@device-port@",
             USERNAME = "@username@", PASSWORD = "@password@", KEY_ID = "@key-id@";
     private static final String PROTOCOL = "protocol_sec";
index 6c37044..a66da69 100644 (file)
@@ -56,9 +56,9 @@ public class NetconfAccessorManager {
 
     public NetconfAccessor getAccessor(NodeId nNodeId, NetconfNode netconfNode) {
         NetconfAccessor res = new NetconfAccessorImpl(nNodeId, netconfNode, netconfCommunicatorManager, domContext, netconfNodeStateService);
-        NetconfAccessor previouse = accessorList.put(nNodeId, res);
+        NetconfAccessor previouse = accessorList.putIfAbsent(nNodeId, res);
         if (Objects.nonNull(previouse)) {
-            LOG.warn("Accessor with name already available. Replaced with new one.");
+            LOG.warn("Accessor with name already available. Don't add {}", nNodeId);
         }
         return res;
     }
@@ -68,7 +68,11 @@ public class NetconfAccessorManager {
     }
 
     public void removeAccessor(NodeId nNodeId) {
-        accessorList.remove(nNodeId);
+        NetconfAccessor previouse = accessorList.remove(nNodeId);
+        if (Objects.nonNull(previouse)) {
+            LOG.warn("Accessor with name was not available during remove {}", nNodeId);
+        }
+
     }
 
 
index 47d5fee..d8720e8 100644 (file)
@@ -95,7 +95,7 @@ public class TokenCreator {
 
     private Algorithm createAlgorithm(String alg, String secret, String pubkey)
             throws IllegalArgumentException, IOException {
-        if(alg==null) {
+        if (alg == null) {
             alg = Config.TOKENALG_HS256;
         }
         switch (alg) {
@@ -153,24 +153,31 @@ public class TokenCreator {
     public String getBearerToken(HttpServletRequest req) {
         return this.getBearerToken(req, false);
     }
+
     public String getBearerToken(HttpServletRequest req, boolean checkCookie) {
         final String authHeader = req.getHeader("Authorization");
         if ((authHeader == null || !authHeader.startsWith("Bearer")) && checkCookie) {
-            Optional<Cookie> ocookie =
-                    Arrays.stream(req.getCookies()).filter(c -> COOKIE_NAME_AUTH.equals(c.getName())).findFirst();
-            if(ocookie.isEmpty()) {
+            Cookie[] cookies = req.getCookies();
+            Optional<Cookie> ocookie = Optional.empty();
+            if (cookies != null) {
+                ocookie = Arrays.stream(cookies).filter(c -> c != null && COOKIE_NAME_AUTH.equals(c.getName()))
+                        .findFirst();
+            }
+            if (ocookie.isEmpty()) {
                 return null;
             }
             return ocookie.get().getValue();
         }
         return authHeader.substring(7);
     }
+
     public UserTokenPayload decode(HttpServletRequest req) throws JWTDecodeException {
         final String token = this.getBearerToken(req);
-        return token!=null?this.decode(token):null;
+        return token != null ? this.decode(token) : null;
     }
-    public UserTokenPayload decode(String token){
-        if(token == null){
+
+    public UserTokenPayload decode(String token) {
+        if (token == null) {
             return null;
         }
         DecodedJWT jwt = JWT.decode(token);
@@ -185,8 +192,8 @@ public class TokenCreator {
     }
 
     public Cookie createAuthCookie(BearerToken data) {
-        Cookie cookie =  new Cookie(COOKIE_NAME_AUTH, data.getToken());
-        cookie.setMaxAge((int)this.tokenLifetimeSeconds);
+        Cookie cookie = new Cookie(COOKIE_NAME_AUTH, data.getToken());
+        cookie.setMaxAge((int) this.tokenLifetimeSeconds);
         cookie.setPath("/");
         cookie.setHttpOnly(true);
         cookie.setSecure(true);
index 3d4d138..41fe3c5 100644 (file)
                             org.opendaylight.aaa.api.shiro.principal,
                             org.opendaylight.aaa.shiro.realm,
                             org.opendaylight.aaa.shiro.filters,
+                            org.opendaylight.aaa.shiro.web.env,
                             org.opendaylight.mdsal.binding.api,
+                            org.opendaylight.mdsal.common.api,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.shiro.configuration,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.authorization,
+                            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.authorization.policies,
                             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.permission,
+                            org.opendaylight.yangtools.concepts,
                             org.opendaylight.yangtools.yang.binding,
+                            org.opendaylight.yangtools.yang.common,
                             com.fasterxml.jackson.databind,
                             com.fasterxml.jackson.databind.deser.std,
                             com.fasterxml.jackson.databind.ser.std,
                             com.fasterxml.jackson.core.type,
                             com.fasterxml.jackson.core,
                             org.apache.commons.codec.binary,
+                            com.google.common.base,
                             com.google.common.collect,
                             com.google.common.util.concurrent
                         </Import-Package>
index b6a7110..b198b61 100644 (file)
             <artifactId>org.osgi.compendium</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jsr310</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
index 95715be..0b64d47 100644 (file)
@@ -32,6 +32,9 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import org.eclipse.jetty.websocket.api.Session;
 import org.eclipse.jetty.websocket.api.WebSocketAdapter;
 import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.data.DOMNotificationOutput;
@@ -120,7 +123,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
      */
     private static final HashMap<String, WebSocketManagerSocket> clientList = new HashMap<>();
 
-    private static final YangToolsMapper mapper = new YangToolsMapper();
+    private static final ObjectMapper mapper = new YangToolsMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
     private final String myUniqueSessionId;
 
     private Session session = null;
@@ -133,6 +136,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
         this.myUniqueSessionId = _genSessionId();
         this.sendingSyncThread = new Thread(this.sendingRunner);
         this.messageQueue = new ArrayBlockingQueue<>(QUEUE_SIZE);
+
     }
 
     @Override