Versions Compared

Key

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

This page describes how to get and build the Istanbul release version of A1-Policy functions up and running locally with two separate near-RT-RIC A1 simulator docker containers providing OSC_2.1.0 version of A1 interface.All four components of these Non-RT RIC function run as docker containers and communicate via a private docker network. Details of the architecture can be found from Istanbul Release page..

However, pre-built versions are available to download, so re-building is not necessary for the majority of users - and should only be attempted by experienced ONAP developers.

For more information on running the pre-built and tested versions see Istanbul - Run

Table of Contents

Project Requirements

  • Java 11 JDK (make sure that JAVA_HOME environment variable points to correct Java version)

  • Maven 3.6

  • Docker and docker-compose (latest)

Build Code

  • Note 1: While instructions to build the artifacts are included below, pre-built versions are available as Docker Images in http://nexus3.onap.org

      Build A1 Policy Management Service container

      Download the ccsdk/oran repo, Istanbul branch: 

      Code Block
      languagebash
      $ git clone "https://gerrit.onap.org/r/ccsdk/oran" -b istanbul

      Configure the A1 Policy Management Service

      To support local test with two separate near-RT-RIC simulator instances:  

      • Copy the file oran/a1-policy-management/config/application_configuration.json  to the current directory and update it with the configuration below.
        (Note the configuration below is just a sample, and should be updated to match particular deployments. 
        The deployment below assumes 4 near-RT-RICs exist - addressable at the urls given.)

      • The controller hostname and port values come from and must match those defined in in the sdnc/oam repo oam/installation/src/main/yaml/docker-compose.yml (see the step "Build A1 Controller" further below). The port for http is 8181.
        (Note the configuration below is just a sample, and should be updated to match particular deployments.  The deployment below assumes anA1 Conrolelr fucntion (SDNC) existd - addressable at the url given, using the authentication credentials given.)

      • Any defined ric host names (in the name and baseUrl for each ric) must match the given docker container names in near-RT-RIC simulator startup - port is always the simulator's internal port 8085 for http or 8185 for https (see the step "Build A1 Controller" further below).

      • It is optional to access the near-RT-RIC through a controller. The "controller" property is optional in the "ric" objects. If no controller is used, the whole "controller" object can be omitted.
        There is no functional gain in accessing the near-RT-RIC through a controller.
      Code Block
      languageyml
      titleSample: application_configuration.json
      linenumberstrue
      {
        "description": "Application configuration",
        "config": {    
          "controller": [
            {
              "name": "controller1",
              "baseUrl": "http://sdnc_controller:8181",
              "userName": "admin",
              "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
            }
          ],
          "ric": [
            {
              "name": "ric1",
              "baseUrl": "http://ric1:8085/", 
              "managedElementIds": [
              ]
            },
            {
              "name": "ric2",
              "baseUrl": "http://ric2:8085/",       
              "managedElementIds": [
                "kista_3",
                "kista_4"
              ]
            },
             {
              "name": "ric3",
              "baseUrl": "http://ric3:8085/",
              "controller": "controller1", 
              "managedElementIds": [
                "kista_5",
                "kista_6"
              ]
            },
             {
              "name": "ric4",
              "baseUrl": "http://ric4:8085/",
              "controller": "controller1", 
              "managedElementIds": [
                "kista_7",
                "kista_8",
                "kista_9",
                "kista_10",
                "kista_11"
               ]
            }
          ]
        }
      }

      JSON Schema for the application configuration

      The configuration must comply to the following JSON schema. There are several tools on internet where it is possible to validate JSON against a schema. 

      Code Block
      languageyml
      titleapplication_configuration_schema.json
      linenumberstrue
      collapsetrue
      {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
          "config": {
            "type": "object",
            "properties": {
              "//description": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "controller": {
                "type": "array",
                "items": [
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "baseUrl": {
                        "type": "string"
                      },
                      "userName": {
                        "type": "string"
                      },
                      "password": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "baseUrl",
                      "userName",
                      "password"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "ric": {
                "type": "array",
                "items": [
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "baseUrl": {
                        "type": "string"
                      },
                      "controller": {
                        "type": "string"
                      },
                      "managedElementIds": {
                        "type": "array",
                        "items": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "baseUrl",
                      "managedElementIds"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "streams_publishes": {
                "type": "object",
                "properties": {
                  "dmaap_publisher": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "dmaap_info": {
                        "type": "object",
                        "properties": {
                          "topic_url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "topic_url"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "dmaap_info"
                    ]
                  }
                },
                "required": [
                  "dmaap_publisher"
                ]
              },
              "streams_subscribes": {
                "type": "object",
                "properties": {
                  "dmaap_subscriber": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "dmaap_info": {
                        "type": "object",
                        "properties": {
                          "topic_url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "topic_url"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "dmaap_info"
                    ]
                  }
                },
                "required": [
                  "dmaap_subscriber"
                ]
              }
            },
            "required": [
              "ric"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "config"
        ]
      }

      For more information on configuring the A1-Policy Management Service please see Istanbul - Component configuration

      Build the code and create docker image

      To build docker image of the policy management service:

      Code Block
      languagebash
      $ cd oran/a1-policy-management/
      $ mvn clean install -Dmaven.test.skip=true

      If the build is successful an image with following name and tag shall be built, use the command 'docker images' to view the newly built image in the local docker registry.

      Code Block
      languagebash
      themeMidnight
      $ docker images
      onap/ccsdk-oran-a1policymanagementservice 1.2.2-SNAPSHOT
      

      Build A1 Adapter for Controller

      Build the code and create docker images

      A1 Adapter is a feature developed within CCSDK which can then be installed in SDNC Karaf Server. To build & run the A1-enabled SDNC Controller, you need to build the ccsdk & sdnc repo's.

      The Controller provides a Northbound Interface, to be used only by the A1 Policy Management Service, allowing it to pass messages over the A1 interface to near-RT-RICs in the RAN.

      Use the downloaded repo 'ccsdk/oran' as in the previous step, "Build A1 Policy Management Service container"

      Code Block
      languagebash
      $ cd a1-adapter
      $ mvn clean install -Dmaven.test.skip=true

      After you build the A1 adapter artifacts, download below CCSDK/SDNC repos and build them in the following order.

      ...

        • Building the code should only be attempted if you really need to, or wish in incorporate some change; it is much easier to use the pre-built versions.
      • Note 2: Before attempting to retrieve or build any ONAP component please follow the instructions for Setting Up Your Development Environment 
      • Note 3: After re-building run the functions by following instructions at Istanbul - Run - but note the version numbers of the newly-built functions may be slightly different from the pre-built versions.

      Build A1 Policy Management Service container

      • Download the ccsdk/oran repo, Istanbul branch: 

        Code Block
        languagebash
        $ git clone "https://gerrit.onap.org/r/ccsdk/oran" -b istanbul


      Build the code and create docker image

      To build docker image of the policy management service:

      Code Block
      languagebash
      $ cd oran/a1-policy-management/
      $ mvn clean install -Dmaven.test.skip=true

      If the build is successful an image with following name and tag shall be built, use the command 'docker images' to view the newly built image in the local docker registry.

      Code Block
      languagebash
      themeMidnight
      $ docker images
      onap/ccsdk-oran-a1policymanagementservice 1.2.2-SNAPSHOT
      

      Build A1 Adapter for Controller

      Build the code and create docker images

      A1 Adapter is a feature developed within CCSDK which can then be installed in SDNC Karaf Server. To build & run the A1-enabled SDNC Controller, you need to build the CCSDK & SDNC repo's.

      The Controller provides a Northbound Interface, to be used only by the A1 Policy Management Service, allowing it to pass messages over the A1 interface to near-RT-RICs in the RAN.

      Use the downloaded repo 'ccsdk/oran' as in the previous step, "Build A1 Policy Management Service container"

      Code Block
      languagebash
      $ cd a1-adapter
      $ mvn clean install -Dmaven.test.skip=true

      After you build the A1 adapter artifacts, download below CCSDK/SDNC repos and build them in the following order.

      ProjectRepoGerrit LinkCommandNote
      CCSDKccsdk/parentgit clone "https://gerrit.onap.org/r/ccsdk/parent" -b istanbul
      mvn clean install -Dmaven.test.skip=trueIf the parent artifacts are not released you need to build this repo in order to build other ccsdk repos (Including ccsdk/oran/a1-adapter)
      CCSDKccsdk/featuresgit clone "https://gerrit.onap.org/r/ccsdk/features" -b istanbul
      mvn clean install -Dmaven.test.skip=true
      CCSDKccsdk/distributiongit clone "https://gerrit.onap.org/r/ccsdk/distribution" -b istanbul
      mvn clean install -Dmaven.test.skip=true -PdockerCreates the CCSDK docker image
      SDNCsdnc/northboundgit clone "https://gerrit.onap.org/r/sdnc/northbound" -b istanbul
      mvn clean install -Dmaven.test.skip=true
      SDNCsdnc/oamgit clone "https://gerrit.onap.org/r/sdnc/oam" -b istanbul
      mvn clean install -Dmaven.test.skip=true -PdockerCreates the SDNC docker image. Make sure you refer the right docker image version in the pom file.(eg: you may need to update ccsdk.docker.version for onap/ccsdk-ansible-server-image from 1.2-STAGING-latest to 1.2-SNAPSHOT-latest)

      Note: full re-builds of the CCSDK and SDNC projects are prone to errors - cloned functions may require manual tweaking to be successful. It is usually better to use pre-built and tested images.

      If your build is unsuccessful more help can be found from the CCSDK/SDNC Developer teams: CCSDK Project & SDNC Project

      If the builds are successful, images with following name and tag shall exist, use the command 'docker images' to view the newly built images in the local docker registry.

      Code Block
      languagebash
      themeMidnight
      $ docker images | grep onap
      onap/sdnc-image latest
      onap/sdnc-ansible-server-image latest
      onap/admportal-sdnc-image latest
      onap/ccsdk-dgbuilder-image latest
      onap/sdnc-ueb-listener-image latest
      onap/sdnc-dmaap-listener-image:latest
      

      Proxy support for A1 adapter

      There is the possibility to use a proxy when CCSDK SLI node function to perform REST calls southbound to near-RT-RICs. 

      In order to configure proxy:

      • Add proxy URL to properties file odlsli/src/main/properties/a1-adapter-api-dg.properties variable a1Mediator.proxy.url
        • This file is part of CCSDK/distribution project
        • After adding this information in the file, the distribution repo from CCSDK must be rebuilt, follow by the SDNC/oam repo.
        • URL format must be protocol://host:port for example http://proxy:8443 

      If the builds are successful, images with following name and tag shall exist, use the command 'docker images' to view the newly built images in the local docker registry.

      Code Block
      languagebash
      themeMidnight
      $ docker images | grep onap
      onap/sdnc-image latest
      onap/sdnc-ansible-server-image latest
      onap/admportal-sdnc-image latest
      onap/ccsdk-dgbuilder-image latest
      onap/sdnc-ueb-listener-image latest
      onap/sdnc-dmaap-listener-image:latest
      

      Proxy support for A1 adapter

      There is the possibility to use a proxy when CCSDK SLI node function to perform REST calls southbound to near-RT-RICs. 

      In order to configure proxy:

      • Add proxy URL to properties file odlsli/src/main/properties/a1-adapter-api-dg.properties variable a1Mediator.proxy.url
        • This file is part of CCSDK/distribution project
        • After adding this information in the file, the distribution repo from CCSDK must be rebuild, follow by the SDNC/oam repo.
        • URL format must be protocol://host:port for example http://proxy:8443 

      Running the functions

      ...

      nexus3.onap.org:10002/onap/ccsdk-oran-a1policymanagementservice:1.2.2

      ...

      nexus3.onap.org:10004/onap/ccsdk-oran-a1policymanagementservice:1.2.2

      ...

      onap/ccsdk-oran-a1policymanagementservice:1.2.2-SNAPSHOT

      ...

      Run A1-enabled Controller

      To view the A1 policy operations, you need to run the SDNC docker image. This image has few other docker image dependencies but not all are important for A1 policy testing. To bring up the sdnc container for A1 Policy Management testing a number of the not needed services can be removed from the docker compose file.

      Edit the docker compose file, oam/installation/src/main/yaml/docker-compose.yaml and keep only sdnc, maria db and ansible images. The rest of the images are not necessary for A1 Policy testing. However if you want to change the DG and run your own DG, you may need to keep the Directed Graph image.

      Code Block
      languagebash
      $ export MTU=1500
      $ docker network create nonrtric-docker-net
      $ cd oam/installation/src/main/yaml
      $ docker-compose up 
      $ docker network connect nonrtric-docker-net sdnc_controller (use another shell)

      The SDNC image will take a while to install all the features into Karaf Server. You can check the logs of the server at /opt/opendaylight/data/log/karaf.log

      Other logs that can be check is /opt/opendaylight/data/log/A1-Adapter.log to see entries coming from DG.

      The A1 Policy in ODL GUI can be accessed by this URL (it may take several minutes before the URL works)

      ...

      (Note these instructions create an A1 Controller deployment scenario aligned towards the sample A1 Policy configuration given above)

      Run OSC Near-RT-RIC/A1 Simulator Docker Containers

      Start docker containers for each near-RT-RIC defined in oran/a1-policy-management/config/application_configuration.json in the step for "Configuration Policy Management Service" (in this example for ric1 and ric2) and providing A1 interface version OSC_2.1.0 with the following commands (use separate shells):

      Code Block
      languagebash
      $ docker run -p 8085:8085 -p 8185:8185 -e A1_VERSION=OSC_2.1.0 -e ALLOW_HTTP=true --network=nonrtric-docker-net --name=ric1 nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
      $ docker run -p 8086:8085 -p 8186:8185 -e A1_VERSION=OSC_2.1.0 -e ALLOW_HTTP=true --network=nonrtric-docker-net --name=ric2 nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
      $ docker run -p 8087:8085 -p 8187:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true --network=nonrtric-docker-net --name=ric3 nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
      $ docker run -p 8088:8085 -p 8188:8185 -e A1_VERSION=STD_2.0.0 -e ALLOW_HTTP=true --network=nonrtric-docker-net --name=ric4 nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0

      ...

      Create a policy type json to load into the A1 simulators (running version OSC.2.1.0)

      Code Block
      languagebash
      titlept1.json
      {
        "name": "pt1",
        "description": "pt1 policy type",
        "policy_type_id": 1,
        "create_schema": {
          "$schema": "http://json-schema.org/draft-07/schema#",
          "title": "OSC_Type1_1.0.0",
          "description": "Type 1 policy type",
          "type": "object",
          "properties": {
            "scope": {
              "type": "object",
              "properties": {
                "ueId": {
                  "type": "string"
                },
                "qosId": {
                  "type": "string"
                }
              },
              "additionalProperties": false,
              "required": [
                "ueId",
                "qosId"
              ]
            },
            "qosObjectives": {
              "type": "object",
              "properties": {
                "priorityLevel": {
                  "type": "number"
                }
              },
              "additionalProperties": false,
              "required": [
                "priorityLevel"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "scope", "qosObjectives"
          ]
        }
      }

      Put the example policy type into the started A1 simulator instances by running these curl commands (in this example to ric1 exposed to port 8085 and ric2 exposed to port 8086):

      Code Block
      languagebash
      $ curl -X PUT -v "http://localhost:8085/a1-p/policytypes/1" -H "accept: application/json" \
       -H "Content-Type: application/json" --data-binary @pt1.json
      $ curl -X PUT -v "http://localhost:8086/a1-p/policytypes/1" -H "accept: application/json" \
       -H "Content-Type: application/json" --data-binary @pt1.json

      Create a policy type json to load into the A1 simulators (running version STD.2.0.0)

      Code Block
      languagebash
      titlestd_qos2_0.0.1.json
      {
          "policySchema": {
            "$schema": "http://json-schema.org/draft-07/schema#",
            "title": "STD_QOS2_0.1.0",
            "description": "STD QOS2 policy type",
            "type": "object",
            "properties": {
              "scope": {
                "type": "object",
                "properties": {
                  "ueId": {
                    "type": "string"
                  },
                  "qosId": {
                    "type": "string"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "ueId",
                  "qosId"
                ]
              },
              "qosObjectives": {
                "type": "object",
                "properties": {
                  "priorityLevel": {
                    "type": "number"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "priorityLevel"
                ]
              }
            }
          },
          "statusSchema": {
            "$schema": "http://json-schema.org/draft-07/schema#",
            "title": "STD_QOS_0.2.0",
            "description": "STD QOS policy type status",
            "type": "object",
            "properties": {
              "enforceStatus": {
                "type": "string"
              },
              "enforceReason": {
                "type": "string"
              },
              "additionalProperties": false,
              "required": [
                "enforceStatus"
              ]
            }
          }
        }

      Put the example policy type into the started A1 simulator instances by running these curl commands (in this example to ric3 exposed to port 8087 and ric4 exposed to port 8088):

      Code Block
      languagebash
      $ curl -X PUT -v "http://localhost:8087/policytype?id=STD_QOS2_0.1.0" -H "accept: application/json" \
       -H "Content-Type: application/json" --data-binary @std_qos2_0.0.1.json
      $ curl -X PUT -v "http://localhost:8088/policytype?id=STD_QOS2_0.1.0" -H "accept: application/json" \
       -H "Content-Type: application/json" --data-binary @std_qos2_0.0.1.json

      For more details about running the OSC A1 Simulator see the related OSC NONRTRIC Wiki page (Release D)  

      Run ONAP A1 Policy Management Service Docker Container

      Run docker container using this command once the A1-enabled Controller and simulators have been fully started and optionally set the logging level to trace (the curl command will not work until the container is fully up and running).
      The configuration, application_configuration.json, of the controller and near-RT-RICs must be mounted as a volume to the container.

      Code Block
      languagebash
      $ docker run -p 8081:8081 --network=nonrtric-docker-net --name=policy-agent-container --volume <Absolute path to application_configuration.json created above>:/opt/app/policy-agent/data/application_configuration.json onap/ccsdk-oran-a1policymanagementservice:1.2.2-SNAPSHOT
      Code Block
      languagebash
      $ curl -X POST  http://localhost:8081/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice -H "Content-Type:application/json" -d {\"configuredLevel\":\"trace\"}

      ...

      Once the Policy Management Service is up and running, it establishes connections to all configured near-RT-RICs (ric1 and ric2) via the A1 Controller.

      ...

      If the policy-agent-container is configured to log at trace level, the following logs entries should appear indicating that connection to the configured RICs has been established successfully via A1 Controller.

      Code Block
      languagebash
      $ docker logs policy-agent-container | grep "checked" 
      2021-03-16 14:15:03.805 DEBUG 1 --- [or-http-epoll-5] o.o.c.o.a.tasks.RicSupervision           : Ric: ric1 checked OK
      2021-03-16 14:15:03.816 DEBUG 1 --- [or-http-epoll-6] o.o.c.o.a.tasks.RicSupervision           : Ric: ric3 checked OK
      2021-03-16 14:15:03.835 DEBUG 1 --- [or-http-epoll-1] o.o.c.o.a.tasks.RicSupervision           : Ric: ric2 checked OK
      2021-03-16 14:15:03.851 DEBUG 1 --- [or-http-epoll-2] o.o.c.o.a.tasks.RicSupervision           : Ric: ric4 checked OK

      A1 Policy Management Service Swagger API

      For troubleshooting/verification purposes you can view/access the policy-agent swagger API from url: http://localhost:8081/swagger-ui.html

      Run OSC Non-RT RIC Control Panel Docker Container

      Control panel use two docker images, one is the Control Panel API Gateway and the NonRTRIC Control Panel.

      In order to start the Control Panel API gateway, an application file is needed to specify the routes and paths accepted by the gateway and where those request are going to be redirect, so the following example can be used:

      Code Block
      titleapplication-nonrtricgateway.yaml
      linenumberstrue
      collapsetrue
      server:
        port: 9090
      spring:
        cloud:
          gateway:
            httpclient:
              ssl:
                useInsecureTrustManager: true
              wiretap: true
            httpserver:
              wiretap: true
            routes:
            - id: A1-Policy
              uri: http://policy-agent-container:8081
              predicates:
              - Path=/a1-policy/**
      management:
        endpoint:
          gateway:
            enabled: true
        endpoints:
          web:
            exposure:
              include: "gateway,loggers,logfile,health,info,metrics,threaddump,heapdump"
      logging:
        level:
          ROOT: ERROR
          org.springframework: ERROR
          org.springframework.cloud.gateway: INFO
          reactor.netty: INFO
        file:
          name: /var/log/nonrtric-gateway/application.log
      
      

      The configuration, application_nonrtricgateway.yaml must be mounted as a volume to the container.

      Run docker container using this command:

      Code Block
      $ docker run -p 9090:9090 --network=nonrtric-docker-net --name=nonrtric-gateway --volume <Absolute path to application_nonrtricgateway.yaml created above>:/opt/app/nonrtric-gateway/config/application.yaml:ro nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-gateway:1.0.0

      In order to run docker container for control panel use the following command: 

      Code Block
      languagebash
      $ docker run -p 8080:8080 --network=nonrtric-docker-net nexus3.o-ran-sc.org:10002/o-ran-sc/nonrtric-controlpanel:2.2.0

      Open NONRTRIC / A1 Policy Control Panel UI

      The Control Panel UI can be accessed by pointing the web-browser to this URL: 

      ...