Search in sources :

Example 1 with DefaultYangModuleId

use of org.onosproject.yang.model.DefaultYangModuleId in project onos by opennetworkinglab.

the class OpenRoadmServiceModelRegistrator method getAppInfo.

private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
    Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();
    // Dependencies for org-openroadm-service
    appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"), new DefaultAppModuleInfo(IetfYangTypes.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-routing-constraints", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmRoutingConstraints.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-common-types", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmCommonTypes.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-resource-types", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmResourceTypes.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-common-service-types", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmCommonServiceTypes.class, null));
    // Dependencies for org-openroadm-common-service-types
    appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-07-15"), new DefaultAppModuleInfo(IetfInetTypes.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-topology", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmTopology.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-topology", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmTopology.class, null));
    // Dependency for org-openroadm-topology
    appInfo.put(new DefaultYangModuleId("org-openroadm-resource", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmResource.class, null));
    appInfo.put(new DefaultYangModuleId("org-openroadm-service", "2016-10-14"), new DefaultAppModuleInfo(OrgOpenroadmService.class, null));
    return ImmutableMap.copyOf(appInfo);
}
Also used : OrgOpenroadmRoutingConstraints(org.onosproject.yang.gen.v1.orgopenroadmroutingconstraints.rev20161014.OrgOpenroadmRoutingConstraints) AppModuleInfo(org.onosproject.yang.runtime.AppModuleInfo) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) HashMap(java.util.HashMap) IetfInetTypes(org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes) OrgOpenroadmResource(org.onosproject.yang.gen.v1.orgopenroadmresource.rev20161014.OrgOpenroadmResource) OrgOpenroadmResourceTypes(org.onosproject.yang.gen.v1.orgopenroadmresourcetypes.rev20161014.OrgOpenroadmResourceTypes) OrgOpenroadmTopology(org.onosproject.yang.gen.v1.orgopenroadmtopology.rev20161014.OrgOpenroadmTopology) OrgOpenroadmService(org.onosproject.yang.gen.v1.orgopenroadmservice.rev20161014.OrgOpenroadmService) IetfYangTypes(org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes) OrgOpenroadmCommonTypes(org.onosproject.yang.gen.v1.orgopenroadmcommontypes.rev20161014.OrgOpenroadmCommonTypes) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) OrgOpenroadmCommonServiceTypes(org.onosproject.yang.gen.v1.orgopenroadmcommonservicetypes.rev20161014.OrgOpenroadmCommonServiceTypes) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) YangModuleId(org.onosproject.yang.model.YangModuleId)

Example 2 with DefaultYangModuleId

use of org.onosproject.yang.model.DefaultYangModuleId in project onos by opennetworkinglab.

the class YangWebResource method getModule.

/**
 * Returns module registered with YANG runtime with given module
 * identifier.
 * If the operation is successful, the JSON presentation of the resource
 * plus HTTP status code "200 OK" is returned. Otherwise,
 * HTTP error status code "400 Bad Request" is returned.
 *
 * @param n for module name
 * @param r for module revision
 * @return HTTP response
 */
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
@Path("/{name}@{revision}")
public String getModule(@PathParam("name") String n, @PathParam("revision") String r) {
    modelRegistry = getService(YangModelRegistry.class);
    YangModule m = modelRegistry.getModule(new DefaultYangModuleId(n, r));
    if (m == null) {
        return Response.status(NOT_FOUND).build().toString();
    }
    String x;
    try {
        x = IOUtils.toString(m.getYangSource(), StandardCharsets.UTF_8);
    } catch (IOException e) {
        log.error("ERROR: handleModuleGetRequest", e.getMessage());
        log.debug("Exception in handleModuleGetRequest:", e);
        return e.getMessage();
    }
    return x;
}
Also used : YangModule(org.onosproject.yang.model.YangModule) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) IOException(java.io.IOException) YangModelRegistry(org.onosproject.yang.runtime.YangModelRegistry) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with DefaultYangModuleId

use of org.onosproject.yang.model.DefaultYangModuleId in project onos by opennetworkinglab.

the class TapiModelRegistrator method getAppInfo.

private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
    Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();
    appInfo.put(new DefaultYangModuleId("tapi-connectivity", "2018-12-10"), new DefaultAppModuleInfo(TapiConnectivity.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-common", "2018-12-10"), new DefaultAppModuleInfo(TapiCommon.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-topology", "2018-12-10"), new DefaultAppModuleInfo(TapiTopology.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-photonic-media", "2018-12-10"), new DefaultAppModuleInfo(TapiPhotonicMedia.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-oam", "2018-12-10"), new DefaultAppModuleInfo(TapiOam.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-odu", "2018-12-10"), new DefaultAppModuleInfo(TapiOdu.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-path-computation", "2018-12-10"), new DefaultAppModuleInfo(TapiPathComputation.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-notification", "2018-12-10"), new DefaultAppModuleInfo(TapiNotification.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-virtual-network", "2018-12-10"), new DefaultAppModuleInfo(TapiVirtualNetwork.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-dsr", "2018-12-10"), new DefaultAppModuleInfo(TapiDsr.class, null));
    appInfo.put(new DefaultYangModuleId("tapi-eth", "2018-12-10"), new DefaultAppModuleInfo(TapiEth.class, null));
    return ImmutableMap.copyOf(appInfo);
}
Also used : AppModuleInfo(org.onosproject.yang.runtime.AppModuleInfo) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) HashMap(java.util.HashMap) TapiConnectivity(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.TapiConnectivity) TapiCommon(org.onosproject.yang.gen.v1.tapicommon.rev20181210.TapiCommon) TapiDsr(org.onosproject.yang.gen.v1.tapidsr.rev20181210.TapiDsr) TapiPhotonicMedia(org.onosproject.yang.gen.v1.tapiphotonicmedia.rev20181210.TapiPhotonicMedia) TapiOdu(org.onosproject.yang.gen.v1.tapiodu.rev20181210.TapiOdu) TapiPathComputation(org.onosproject.yang.gen.v1.tapipathcomputation.rev20181210.TapiPathComputation) TapiVirtualNetwork(org.onosproject.yang.gen.v1.tapivirtualnetwork.rev20181210.TapiVirtualNetwork) TapiOam(org.onosproject.yang.gen.v1.tapioam.rev20181210.TapiOam) TapiNotification(org.onosproject.yang.gen.v1.tapinotification.rev20181210.TapiNotification) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) TapiTopology(org.onosproject.yang.gen.v1.tapitopology.rev20181210.TapiTopology) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) YangModuleId(org.onosproject.yang.model.YangModuleId) TapiEth(org.onosproject.yang.gen.v1.tapieth.rev20181210.TapiEth)

Example 4 with DefaultYangModuleId

use of org.onosproject.yang.model.DefaultYangModuleId in project onos by opennetworkinglab.

the class YangModelRegistrator method getAppInfo.

private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
    Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();
    appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-07-15"), new DefaultAppModuleInfo(IetfInetTypes.class, null));
    appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"), new DefaultAppModuleInfo(IetfYangTypes.class, null));
    List<String> systemFeatures = new ArrayList<>();
    systemFeatures.add("local-users");
    systemFeatures.add("authentication");
    systemFeatures.add("ntp");
    appInfo.put(new DefaultYangModuleId("ietf-system", "2014-08-06"), new DefaultAppModuleInfo(IetfSystem.class, systemFeatures));
    return ImmutableMap.copyOf(appInfo);
// TODO: Do some other registration tasks...
}
Also used : AppModuleInfo(org.onosproject.yang.runtime.AppModuleInfo) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) HashMap(java.util.HashMap) IetfYangTypes(org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes) ArrayList(java.util.ArrayList) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) IetfInetTypes(org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes) IetfSystem(org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) YangModuleId(org.onosproject.yang.model.YangModuleId)

Example 5 with DefaultYangModuleId

use of org.onosproject.yang.model.DefaultYangModuleId in project onos by opennetworkinglab.

the class CienaWaveserverAiModelRegistrator method getAppInfo.

private static Map<YangModuleId, AppModuleInfo> getAppInfo() {
    Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>();
    appInfo.put(new DefaultYangModuleId("ciena-waveserver-system", "2018-01-04"), new DefaultAppModuleInfo(CienaWaveserverSystem.class, null));
    appInfo.put(new DefaultYangModuleId("ciena-waveserver-port", "2017-07-31"), new DefaultAppModuleInfo(CienaWaveserverPort.class, null));
    return ImmutableMap.copyOf(appInfo);
// TODO: Do some other registration tasks...
}
Also used : DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) AppModuleInfo(org.onosproject.yang.runtime.AppModuleInfo) CienaWaveserverPort(org.onosproject.yang.gen.v1.cienawaveserverport.rev20170731.CienaWaveserverPort) HashMap(java.util.HashMap) CienaWaveserverSystem(org.onosproject.yang.gen.v1.cienawaveserversystem.rev20180104.CienaWaveserverSystem) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) DefaultAppModuleInfo(org.onosproject.yang.runtime.DefaultAppModuleInfo) DefaultYangModuleId(org.onosproject.yang.model.DefaultYangModuleId) YangModuleId(org.onosproject.yang.model.YangModuleId)

Aggregations

DefaultYangModuleId (org.onosproject.yang.model.DefaultYangModuleId)6 HashMap (java.util.HashMap)5 YangModuleId (org.onosproject.yang.model.YangModuleId)5 AppModuleInfo (org.onosproject.yang.runtime.AppModuleInfo)5 DefaultAppModuleInfo (org.onosproject.yang.runtime.DefaultAppModuleInfo)5 IetfInetTypes (org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes)3 IetfYangTypes (org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes)2 OrgOpenroadmCommonTypes (org.onosproject.yang.gen.v1.orgopenroadmcommontypes.rev20161014.OrgOpenroadmCommonTypes)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 CienaWaveserverPort (org.onosproject.yang.gen.v1.cienawaveserverport.rev20170731.CienaWaveserverPort)1 CienaWaveserverSystem (org.onosproject.yang.gen.v1.cienawaveserversystem.rev20180104.CienaWaveserverSystem)1 IetfSystem (org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem)1 OrgOpenroadmCommonServiceTypes (org.onosproject.yang.gen.v1.orgopenroadmcommonservicetypes.rev20161014.OrgOpenroadmCommonServiceTypes)1 OrgOpenroadmDegree (org.onosproject.yang.gen.v1.orgopenroadmdegree.rev20161014.OrgOpenroadmDegree)1 OrgOpenroadmEquipmentStatesTypes (org.onosproject.yang.gen.v1.orgopenroadmequipmentstatestypes.rev20161014.OrgOpenroadmEquipmentStatesTypes)1