Code Monkey home page Code Monkey logo

transportpce's People

Contributors

ahmed-triki avatar ahmedeldeeb25-zz avatar aseaudi avatar askb avatar beegeesquare avatar christophebetoule avatar collivier avatar edelfour avatar gaelsimon2 avatar gthouenon avatar guillaumelambert avatar jacksitlab avatar jackykun avatar javoerrea avatar manuedelf avatar mcoulibay avatar narayanpadi avatar ojnas avatar orenais avatar pyro2266 avatar ramy1313 avatar rovarga avatar shibotanany avatar skitt avatar svachhaniatt avatar zxiiro avatar

Stargazers

 avatar

Watchers

 avatar

transportpce's Issues

optimize serialization/deserialization

With additional import of odl OSGi-Service
<reference id="parserFactory" interface="org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory" />
it should be much easier to serialize data like ODL does

import com.google.gson.stream.JsonWriter;
import org.opendaylight.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208.Configuration;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208.ConfigurationBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208.configuration.EntryBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208.configuration.EntryKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint8;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.parser.api.YangParser;
import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl;
...

private void serialize(Configuration configuration) {
    final YangParser parser = this.yangParserFactory.createParser();
    final EffectiveModelContext schemaContext = parser.buildEffectiveModel();
    final NormalizedNode<?, ?> data = BINDING_CONTEXT.toNormalizedNode(
                InstanceIdentifier.create(Configuration.class), configuration).getValue();
    final String json = toJson(data, schemaContext);
}
    private static String toJson(final NormalizedNode<?, ?> node, final EffectiveModelContext schemaContext) {
        final JSONCodecFactory codecFactory = JSONCodecFactorySupplier.RFC7951.createSimple(schemaContext);
        try (StringWriter stringWriter = new StringWriter();
             JsonWriter jsonWriter = new JsonWriter(stringWriter);
             NormalizedNodeWriter nodeStreamer = NormalizedNodeWriter.forStreamWriter(
                     JSONNormalizedNodeStreamWriter.createNestedWriter(codecFactory, SchemaPath.ROOT,
                             schemaContext.getQName().getNamespace(), jsonWriter))) {
            jsonWriter.beginObject();
            nodeStreamer.write(node);
            jsonWriter.endObject();
            return stringWriter.toString();
        } catch (IOException e) {
            throw new IllegalStateException("Failed to convert input node to JSON: " + node, e);
        }
    }

Task is to replace our internal yangtools independent serializer with this one, to solve not covered bugs in the existing serializer

bad topology on different mount order

  • int test is failing when I change the mount order in remote scenario
  • doesn't happen in standalone mode
  • detected by ietf-networks topology check(e.g. otn-topology)

improve integration test duration

Add a globals class which can be included by all transportpce subprojects (at least those with manual delays) and define these delay values there and so replace them with the variable values.

They should be the same as before, but overridable by env var

Maybe transportpce/common is the best location for this

Example

package org.opendaylight.transportpce.common;

public class Globals {

    public static int SLEEP_10000 = getEnvOrDefault(SLEEP_10000,10000);
}

private static int getEnvOrDefault(String envVar, int def) {
...
}

to find all sleep commands in the transportpce code

grep "Thread.sleep(" $(find -name *.java) | grep -v target 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.