Prerequisites
-------------
-1. Java development kit (JDK), version 8
-2. Maven dependency-management tool, version 3.4 or later
-3. Python, version 2
-4. Docker, version 19.03.1 or later
-5. Docker Compose, version 1.24.1 or later
+1. Java development kit (JDK), version 11
+2. Maven dependency-management tool, version 3.6 or later
+3. Python, version 2 or later
+4. Docker, version 19.03.1 or latest
+5. Docker Compose, version 1.24.1 or latest
Build and run
-------------
Go to the northbound directory and run this command ::
- mvn clean install
+ mvn clean install -Dmaven.test.skip=true
This will build the project and create artifcats in maven repo
Go to oam/installation directory and run this command ::
mvn clean install -P docker
-This will create the docker images required for the A1 Controller
+This will create the docker images required for a1-controller.
After this step check for the docker images created by the maven build with this command ::
docker images | grep a1-controller
Go to oam/installation/src/main/yaml and run this command ::
docker-compose up -d a1-controller
-This will create the docker containers with the A1 Controller image, you can check the status of the docker container using ::
+This will create the docker containers with the a1-controller image, you can check the status of the docker container using ::
docker-compose logs -f a1-controller
-The SDNC url to access the Northbound API,
+The Open Daylight GUI url to access the Northbound API,
http://localhost:8282/apidoc/explorer/index.html
Credentials: admin/Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
parameters:
- name: managedElementId
in: query
- description: managedElementId
+ description: The ID of the Managed Element
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: RIC is found
parameters:
- name: policyType
in: query
- description: policyType
+ description: The name of the policy type
required: false
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: false
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: 'Service supervision timer refreshed, OK'
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
+ <exec.skip>true</exec.skip>
</properties>
<dependencies>
<dependency>
value = {
@ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicySchemas(@ApiParam(name = "ric", required = false, value = "The name of " +//
- "the Near-RT RIC to get the definitions for.")@RequestParam(name = "ric", required = false) String ricName) {
+ public ResponseEntity<String> getPolicySchemas( //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") //
+ @RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
return new ResponseEntity<>(toPolicyTypeSchemasJson(types), HttpStatus.OK);
value = { //
@ApiResponse(code = 200, message = "Policy schema", response = Object.class),
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicySchema(@ApiParam(name = "id", required = true, value = "The ID of the " +//
- "policy type to get the definition for.")@RequestParam(name = "id", required = true) String id) {
+ public ResponseEntity<String> getPolicySchema( //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy type to get the definition for.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
PolicyType type = policyTypes.getType(id);
return new ResponseEntity<>(type.schema(), HttpStatus.OK);
response = String.class,
responseContainer = "List"),
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicyTypes(@ApiParam(name = "ric", required = false, value = "The name of " +//
- "the Near-RT RIC to get types for.")@RequestParam(name = "ric", required = false) String ricName) {
+ public ResponseEntity<String> getPolicyTypes( //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") //
+ @RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
return new ResponseEntity<>(toPolicyTypeIdsJson(types), HttpStatus.OK);
@ApiResponse(code = 404, message = "Policy is not found")} //
)
public ResponseEntity<String> getPolicy( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String id) {
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
Policy p = policies.getPolicy(id);
return new ResponseEntity<>(p.json(), HttpStatus.OK);
@ApiResponse(code = 404, message = "Policy is not found", response = String.class),
@ApiResponse(code = 423, message = "RIC is not operational", response = String.class)})
public Mono<ResponseEntity<Object>> deletePolicy( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String id) {
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
Policy policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceName());
})
public Mono<ResponseEntity<Object>> putPolicy( //
@ApiParam(name = "type", required = false, value = "The name of the policy type.") //
- @RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String instanceId, //
- @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " +//
- "created.")@RequestParam(name = "ric", required = true) String ricName, //
+ @RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String instanceId, //
+ @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " + //
+ "created.") //
+ @RequestParam(name = "ric", required = true) String ricName, //
@ApiParam(name = "service", required = true, value = "The name of the service creating the policy.") //
- @RequestParam(name = "service", required = true) String service, //
- @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " +//
- "defaulted to false). A policy is transient if it will be forgotten when the service needs to " +//
- "reconnect to the Near-RT RIC.")@RequestParam(name = "transient", required = false, //
- defaultValue = "false") boolean isTransient, //
+ @RequestParam(name = "service", required = true) String service, //
+ @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " + //
+ "defaulted to false). A policy is transient if it will be forgotten when the service needs to " + //
+ "reconnect to the Near-RT RIC.") //
+ @RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
String jsonString = gson.toJson(jsonBody);
@ApiResponse(code = 404, message = "RIC or type not found", response = String.class)})
public ResponseEntity<String> getPolicies( //
@ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
- @RequestParam(name = "type", required = false) String type, //
+ @RequestParam(name = "type", required = false) String type, //
@ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
- @RequestParam(name = "ric", required = false) String ric, //
+ @RequestParam(name = "ric", required = false) String ric, //
@ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
- @RequestParam(name = "service", required = false) String service) //
+ @RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
@ApiResponse(code = 404, message = "RIC or type not found", response = String.class)})
public ResponseEntity<String> getPolicyIds( //
@ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
- @RequestParam(name = "type", required = false) String type, //
+ @RequestParam(name = "type", required = false) String type, //
@ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
- @RequestParam(name = "ric", required = false) String ric, //
+ @RequestParam(name = "ric", required = false) String ric, //
@ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
- @RequestParam(name = "service", required = false) String service) //
+ @RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
@ApiResponse(code = 404, message = "Policy is not found", response = String.class)} //
)
public Mono<ResponseEntity<String>> getPolicyStatus( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy.")@RequestParam(name = "id", //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy.") @RequestParam(
+ name = "id", //
required = true) String id) {
try {
Policy policy = policies.getPolicy(id);
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@ApiResponse(code = 200, message = "RIC is found", response = String.class), //
@ApiResponse(code = 404, message = "RIC is not found", response = String.class) //
})
- public ResponseEntity<String> getRic(
+ public ResponseEntity<String> getRic( //
+ @ApiParam(name = "managedElementId", required = true, value = "The ID of the Managed Element") //
@RequestParam(name = "managedElementId", required = true) String managedElementId) {
-
Optional<Ric> ric = this.rics.lookupRicForManagedElement(managedElementId);
if (ric.isPresent()) {
value = { //
@ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "Policy type is not found", response = String.class)})
- public ResponseEntity<String> getRics(
+ public ResponseEntity<String> getRics( //
+ @ApiParam(name = "policyType", required = false, value = "The name of the policy type") //
@RequestParam(name = "policyType", required = false) String supportingPolicyType) {
-
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
}
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@ApiResponse(code = 200, message = "OK", response = ServiceStatus.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "Service is not found", response = String.class)})
public ResponseEntity<String> getServices(//
+ @ApiParam(name = "name", required = false, value = "The name of the service") //
@RequestParam(name = "name", required = false) String name) {
-
if (name != null && this.services.get(name) == null) {
return new ResponseEntity<>("Service not found", HttpStatus.NOT_FOUND);
}
@ApiResponse(code = 404, message = "Service not found", response = String.class)})
@DeleteMapping("/services")
public ResponseEntity<String> deleteService(//
+ @ApiParam(name = "name", required = true, value = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
Service service = removeService(serviceName);
@ApiResponse(code = 404, message = "The service is not found, needs re-registration")})
@PutMapping("/services/keepalive")
public ResponseEntity<String> keepAliveService(//
+ @ApiParam(name = "name", required = true, value = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
services.getService(serviceName).keepAlive();
<packaging>feature</packaging>
<name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
<dependencies>
<dependency>
<name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>odl-mdsal-broker</artifactId>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>ccsdk-sli</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nonrt-ric-api-model</artifactId>
<artifactId>nonrt-ric-api-provider</artifactId>
<version>${project.version}</version>
</dependency>
-
</dependencies>
</project>
</plugins>
</build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
<dependencies>
<dependency>
<groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
<artifactId>nonrt-ric-api-model</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- </dependency>
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-test-model</artifactId>
- <scope>test</scope>
- </dependency>
-
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-broker-impl</artifactId>
<version>3.14.6</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
</dependencies>
</project>
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.A1ADAPTERAPIService;
import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyInput;
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
protected RpcProviderRegistry rpcRegistry;
- protected BindingAwareBroker.RpcRegistration<?> rpcRegistration;
private RestAdapter restAdapter;
public NonrtRicApiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
public void initialize() {
log.info("Initializing provider for {}", APP_NAME);
- createContainers();
restAdapter = new RestAdapterImpl();
log.info("Initialization complete for {}", APP_NAME);
}
- protected void initializeChild() {
- // Override if you have custom initialization intelligence
- }
-
@Override
public void close() throws Exception {
log.info("Closing provider for {}", APP_NAME);
executor.shutdown();
- rpcRegistration.close();
log.info("Successfully closed provider for {}", APP_NAME);
}
}
}
- private void createContainers() {
-
- final WriteTransaction t = dataBroker.newReadWriteTransaction();
-
- try {
- CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
- checkedFuture.get();
- log.info("Create containers succeeded!");
-
- } catch (InterruptedException | ExecutionException e) {
- log.error("Create containers failed: ", e);
- Thread.currentThread().interrupt();
- }
- }
-
@Override
public ListenableFuture<RpcResult<PutA1PolicyOutput>> putA1Policy(PutA1PolicyInput input) {
log.info("Start of putPolicy");