Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

TAPI based RESTCONF not work #4

@hrk091

Description

@hrk091

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions