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;
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));
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;
}
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 {
<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>
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.sql.ConnectionPoolDataSource;
+
public class SqlDBClient {
private static final Logger LOG = LoggerFactory.getLogger(SqlDBClient.class);
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
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() {
}
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();
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;
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();
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;
}
}
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();
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;
}
long minorCount = 0;
long warningCount = 0;
ResultSet data;
+ if(LOG.isTraceEnabled()){
+ LOG.trace("query={}", selectQuery);
+ }
try {
data = this.dbClient.read(selectQuery);
String severity;
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()) {
@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
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";
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;
MariaDBTestBase.testCreateTableStructure(dbClient);
dbProvider.setControllerId();
CONTROLLERID = dbProvider.getControllerId();
+ dbProviderOverall = testBase.getOverallDbProvider();
}
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);
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();
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());
}
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));
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();
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 {
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 {
public SqlDBDataProvider getDbProvider() {
return dbProvider;
}
+ public SqlDBDataProvider getOverallDbProvider() {
+ return dbProviderOverall;
+ }
public DB getDb() {
return db;
<groupId>com.highstreet-technologies.opendaylight</groupId>
<artifactId>odl-ready</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ </dependency>
</dependencies>
<build>
if (onapCCSDKVersion == null) {
return def;
}
+ if (onapCCSDKVersion.startsWith("2.5.")) {
+ return "ONAP London";
+ }
if (onapCCSDKVersion.startsWith("2.4.")) {
return "ONAP Kohn";
}
}
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)");
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"
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;
@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);
}
+++ /dev/null
-/*
- * 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));
- }
-}
--- /dev/null
+/*
+ * ============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);
+ }
+ }
+
+}
<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>
<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>
<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>
<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>
@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);
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) {
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) {
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) {
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()));
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");
--- /dev/null
+/*
+ * ============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);
+ }
+ }
+
+}
+++ /dev/null
-/*
- * 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));
- }
-}
# 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
+++ /dev/null
-# 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
+++ /dev/null
-# 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
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@";
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"
+ "}";
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"
+ "}";
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";
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;
}
}
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);
+ }
+
}
private Algorithm createAlgorithm(String alg, String secret, String pubkey)
throws IllegalArgumentException, IOException {
- if(alg==null) {
+ if (alg == null) {
alg = Config.TOKENALG_HS256;
}
switch (alg) {
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);
}
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);
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>
<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>
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;
*/
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;
this.myUniqueSessionId = _genSessionId();
this.sendingSyncThread = new Thread(this.sendingRunner);
this.messageQueue = new ArrayBlockingQueue<>(QUEUE_SIZE);
+
}
@Override