Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAPI based RESTCONF not work #4

Open
hrk091 opened this issue Jan 16, 2018 · 0 comments
Open

TAPI based RESTCONF not work #4

hrk091 opened this issue Jan 16, 2018 · 0 comments

Comments

@hrk091
Copy link

hrk091 commented Jan 16, 2018

I've tried to implement TAPI RESTCONF NBI using TAPI model(onos/models/tapi) using DynamicConfigurationSubsystem. With the help of l3vpn and openroadm sample app, I made sample code below:

package org.onosproject.tapi.service;

import com.google.common.collect.ImmutableMap;
import org.apache.felix.scr.annotations.Component;
import org.onosproject.yang.AbstractYangModelRegistrator;
import org.onosproject.yang.gen.v1.tapicommon.rev20170531.TapiCommon;
import org.onosproject.yang.gen.v1.tapiconnectivity.rev20170531.TapiConnectivity;
import org.onosproject.yang.gen.v1.tapipathcomputation.rev20170531.TapiPathComputation;
import org.onosproject.yang.gen.v1.tapitopology.rev20170531.TapiTopology;
import org.onosproject.yang.model.DefaultYangModuleId;
import org.onosproject.yang.model.YangModuleId;
import org.onosproject.yang.runtime.AppModuleInfo;
import org.onosproject.yang.runtime.DefaultAppModuleInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * Component to register the OpenConfig service model and its dependencies.
 */
@Component(immediate = true)
public class TapiServiceModelRegistrator extends AbstractYangModelRegistrator {
    public TapiServiceModelRegistrator() {
        super(TapiConnectivity.class, getAppInfo());
    }

    private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
        Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();

        appInfo.put(new DefaultYangModuleId("tapi-connectivity", "2017-05-31"),
                    new DefaultAppModuleInfo(TapiConnectivity.class, null));

        // Dependencies for tapi-connectivity
        appInfo.put(new DefaultYangModuleId("tapi-common", "2017-05-31"),
                    new DefaultAppModuleInfo(TapiCommon.class, null));
        appInfo.put(new DefaultYangModuleId("tapi-topology", "2017-05-31"),
                    new DefaultAppModuleInfo(TapiTopology.class, null));
        appInfo.put(new DefaultYangModuleId("tapi-path-computation", "2017-05-31"),
                    new DefaultAppModuleInfo(TapiPathComputation.class, null));
        

        return ImmutableMap.copyOf(appInfo);
    }
}

But it didn't work correctly. When I tried to post

{
  "tapi-common:context": {
  	"service-interface-point": []
  }
}

to RESTCONF API, it returned 500 Internal Server Error, and the following error are shown in onos log:

2018-01-16 17:30:18,138 | ERROR | qtp1273768067-39 | RestconfUtils                    | 175 - org.onosproject.onos-apps-restconf-utils - 1.13.0.SNAPSHOT | convertJsonToDataN
ode failure: Method called for other then data node
2018-01-16 17:30:18,138 | ERROR | qtp1273768067-39 | RestconfWebResource              | 177 - org.onosproject.onos-protocols-restconf-server-rpp - 1.13.0.SNAPSHOT | ERROR: h
andlePostRequest: ERROR: JSON cannot be converted to DataNode

Namespace and JSON schema may be correct, because when I tried another config which has wrong namespace or JSON schema RESTCONF API returned different messages( and they indicated right error cause).
I've created OpenConfig RESTCONF API in a same way using DynamicConfigSubsystem, it works fine. So this issue might be unique to TAPI model, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant