Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Configuration

Configuration of the SDNC SDN-C Context Builder is done via config/application.properties (TODO: to be updated when SDNC Context Builder can be installed by OOM)

...

Code Block
titleProvide basic authorization
  # HTTP Basic Authorization credentials for Rest Service API
  sdncCtxBuilder.userId=<username for basic authorization>
  sdncCtxBuilder.password=<password for basic authorization>

Interfaces/API

The SDN-C Context builder supports the use of the GENERIC-RESPONSE-API and VNF-API on the SDN-C

URI example using GENERIC-RESPONSE-API

Code Block
titleSDC Context Builder URI example for GENERIC-RESPONSE-API
http://localhost10.147.113.136:8080/sdnccontextbuilder/v1/service/context?serviceInstanceId=7d51825768352304-49bd7bba-40ac4609-8d178551-017a726ec12a0d0b819376c3

JSON response GENERIC-RESPONSE-API example

Code Block
languagexml
titleSDC Context Builder JSON response GENERIC-RESPONSE-API example
collapsetrue
{
    "service": {
        "name": "vcpe_svc_vcpesvc_rescust_0822a_201808262153",
        "invariantUUID": "3a4e6986-5c5e-434e-b0be-8d718107fa83",
        "uuid": "7d518257-49bd-40ac-8d17-017a726ec12a",
        "dataQuality": {
            "status": "ok"
        },
        "attributeList": []
    },
    "dataQuality": {
        "status": "ok"
    },
    "attributeList": [],
    "vfList": [
        {
            "name": "zRegionOne06",
            "type": "vcpesvc_rescust_0822a/vcpevsp_vgw_0822a 0",
            "invariantUUID": "71370375-e1b4-4ad2-9832-1b7877428c81",
            "uuid": "7dd31559-9fc6-4b0d-bbe3-7ba641bf8a9b",
            "dataQuality": {
                "status": "ok"
            },
            "attributeList": [],
            "vfModuleList": [
                {
                    "name": "zRegionOne06_base_vcpe_vgw_0",
                    "invariantUUID": "7e91451d-e320-4755-a1a8-fcf140b86779",
                    "uuid": "1908874e-cfae-4ee1-93b9-f4ba46b460ff",
                    "maxInstances": 0,
                    "minInstances": 0,
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": [],
                    "vmList": [
                        {
                            "name": "zRegionOne06001",
                            "nfNamingCode": "vgw",
                            "dataQuality": {
                                "status": "ok"
                            },
                            "attributeList": []
                        }
                    ],
                    "networkList": []
                }
            ],
            "vnfcList": []
        }
    ]
}


URI example for VNF-API

Code Block
languagexml
titleURI example for VNF-API
http://10.147.113.136:8080/sdnccontextbuilder/v1/service/context?serviceInstanceId=7d518257-49bd-40ac-8d17-017a726ec12a


JSON response example fro VNF-API

Code Block
languagebash
titleJSON response example fro VNF-API
collapsetrue
{
    "service": {
        "name": "vFW service instance",
        "uuid": "7d518257-49bd-40ac-8d17-017a726ec12a",
        "dataQuality": {
            "status": "ok"
        },
        "attributeList": []
    },
    "dataQuality": {
        "status": "ok"
    },
    "attributeList": [],
    "vfList": [
        {
            "name": "zdyh3bsflb0001v_01",
            "type": "vShaken_DNS_ns592n/vSHAKEN_IST_09042018 0",
            "invariantUUID": "null",
            "uuid": "null",
            "dataQuality": {
                "status": "ok"
            },
            "attributeList": [],
            "vfModuleList": [
                {
                    "uuid": "2c3f8902-f278-4ee3-93cf-9d2364cbafca",
                    "maxInstances": 1,
                    "minInstances": 0,
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": [],
                    "vmList": [],
                    "networkList": []
                }
            ],
            "vnfcList": [
                {
                    "name": "dyh3bsflb0001vm001",
                    "invariantUUID": "null",
                    "uuid": "null",
                    "type": "alb",
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": []
                },
                {
                    "name": "dyh3bsflb0001vm002",
                    "invariantUUID": "null",
                    "uuid": "null",
                    "type": "alb",
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": []
                }
            ]
        }
    ]
}


API Configuration

The following refers to the ONAP code for SdncContextBuilder in https://gerrit.onap.org/r/#/admin/projects/logging-analytics/pomba/pomba-sdnc-context-builder.

Configuration of the API (currently only GENERIC-RESOURCE-API and VNF-API) is done through the following configuration files.


config/dynamic/conf/api-handlers.xml

This file is used to identify the Handler Beans (Java classes) that get invoked for the various API. New API Beans can be added here after the Java Classes are coded and built into the image.

Code Block
languagexml
titleapi-handlers.xml
collapsetrue
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="vnfApiHandler" class="org.onap.pomba.contextbuilder.sdnc.handlers.VnfApiHandler" >
    </bean>

    <bean id="genericResourceApiHandler" class="org.onap.pomba.contextbuilder.sdnc.handlers.GenericResourceApiHandler" >
    </bean>

</beans>


config/dynamic/routes/sdnc-api.route

Used to map a name (in this case the API name) to the previously defined Handler Beans. New Handler Beans need to be mapped here.

Code Block
languagexml
titlesdnc-api.route
collapsetrue
<route xmlns="http://camel.apache.org/schema/spring" trace="true" id="apiMapperRoute">
   <from uri="direct:startRoutingProcess" />
           <choice>
               <when>
                   <simple>${in.body.apiName} == 'VNF-API'</simple>
                   <log message="Processing ${in.body.apiName} by Camel Routing Context"/>
                   <to uri="bean:vnfApiHandler?method=process"/>
               </when>
               <when>
                   <simple>${in.body.apiName} == 'GENERIC-RESOURCE-API'</simple>
                   <log message="Processing ${in.body.apiName} by Camel Routing Context"/>
                   <to uri="bean:genericResourceApiHandler?method=process"/>
               </when>
           </choice>
</route>





config/rules/api-mapping-rules.drl

Rules logic to select the Mapping and hence the Handler Bean based on the ServiceEntity.serviceType that is extracted from the resourceLink by RestUtil.createServiceEntityObj(). 

No Java changes are required to implement theses rules.

Code Block
languagegroovy
titleapi-mapping-rules.drl
collapsetrue
/*
 * ============LICENSE_START===================================================
 * Copyright (c) 2018 Amdocs
 * ============================================================================
 * 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.pomba.contextbuilder.sdnc.rules;

import org.onap.pomba.contextbuilder.sdnc.model.ServiceEntity;

rule "ApiMapping-1"
    no-loop  true
    lock-on-active true
    when
      $s : ServiceEntity( (serviceType not contains "vFW") && (serviceType not contains "vDNS") )
    then
      $s.setApiName("GENERIC-RESOURCE-API");
end


rule "ApiMapping-2"
    no-loop  true
    lock-on-active true
    when
      $s : ServiceEntity( (serviceType contains "vFW") || (serviceType contains "vDNS") )
    then
      $s.setApiName("VNF-API");
end


Error Code

Error CodeDescriptionResolution
400missing AppId from the headerProvide AppId in the header and re-send the request
401missing basic auth from the headerProvide basic authorization in the header and re-send the request