.. _gerrit: https://gerrit.o-ran-sc.org/r/admin/repos/portal/nonrtric-controlpanel
-- Start the backend:
-
- cd webapp-backend
-
- mvn clean install
-
- mvn -Dorg.oransc.portal.nonrtric.controlpanel=mock -Dtest=MockControlPanelBackEnd -DfailIfNoTests=false test
-
-
-- Now you can open URL: `localhost:8080`_ in a browser to access the backend directly.
-
-.. _localhost:8080: http://localhost:8080
-
Start the frontend:
cd webapp-frontend
-
- ./ng serve --proxy-config proxy.conf.json
+
+ To start the frontend with Mock data:
+
+ npm run start:mock
+
+ To start the UI:
+
+ You need to start the ControlPanel API Gateway, Policy Management Service & EI Service for the UI to list policy & EI information
+
+ ./ng serve --proxy-config proxy.conf.json
+
+ OR
+
+ npm start
- Now you can open URL: `localhost:4200`_ in a browser to access the Control Panel.
WORKDIR /opt/app/nonrtric-gateway
RUN mkdir -p /var/log/nonrtric-gateway
-EXPOSE 8081 8433
+EXPOSE 9090
ADD /config/application.yaml /opt/app/nonrtric-gateway/config/application.yaml
ADD target/${JAR} /opt/app/nonrtric-gateway/nonrtric-gateway.jar
httpserver:
wiretap: true
routes:
- - id: policytypes
+ - id: A1-Policy
uri: https://localhost:8433
predicates:
- - Path=/a1-policy/v2/policy-types/**
- - id: policies
+ - Path=/a1-policy/**
+ - id: A1-EI
uri: https://localhost:8433
predicates:
- - Path=/a1-policy/v2/policies/**
+ - Path=/ei-producer/**
management:
endpoint:
gateway:
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--<![CDATA[
-========================LICENSE_START=================================
-O-RAN-SC
-%%
-Copyright (C) 2019 AT&T Intellectual Property
-Modifications Copyright (C) 2020 Nordix Foundation
-%%
-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===================================
-]]>-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <!-- this group Id must match LF gerrit repository -->
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>2.3.4.RELEASE</version>
- <relativePath /> <!-- lookup parent from repository -->
- </parent>
- <groupId>org.o-ran-sc.portal.nonrtric.controlpanel</groupId>
- <artifactId>nonrtric-controlpanel-parent</artifactId>
- <name>Non-RT RIC Control Panel project</name>
- <packaging>pom</packaging>
- <version>2.2.0-SNAPSHOT</version>
- <properties>
- <java.version>11</java.version>
- <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
- </properties>
- <modules>
- <module>webapp-backend</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>${java.version}</source>
- <target>${java.version}</target>
- </configuration>
- </plugin>
- <!-- Always generate a source jar -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- Always skip the deploy-jar-to-nexus step -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <!-- support sonar in multi-module project -->
- <plugin>
- <groupId>org.sonarsource.scanner.maven</groupId>
- <artifactId>sonar-maven-plugin</artifactId>
- <version>${sonar-maven-plugin.version}</version>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-/.classpath
-/.project
-/.settings
-/target/
-/logs/
-/.mvn/wrapper/maven-wrapper.jar
-bin/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-/build/
-
-/application-tlab2.properties
-/application.properties
-/controlpanel-users.json
+++ /dev/null
-# Non-RT RIC Control Panel Web Application Backend
-
-The Non-RT RIC Control Panel back-end provides REST services to the Control Panel
-front-end Typescript features running in the user's browser. For
-production use, it also serves the Angular application files.
-
-Please see the documentation in the docs/ folder.
-
-The backend server publishes live API documentation at the
-URL `http://your-host-name-here:8080/swagger-ui.html`
-
-## License
-
-Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
-Modifications Copyright (C) 2019 Nordix Foundation
-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.
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * %%
- * 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===================================
- -->
-<profiles version="13">
-<profile kind="CodeFormatterProfile" name="java-formatter" version="12">
-<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
-<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="48"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
-<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
-<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
-<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
-<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
-<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
-</profile>
-</profiles>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--<![CDATA[
-========================LICENSE_START=================================
-O-RAN-SC
-%%
-Copyright (C) 2019 AT&T Intellectual Property
-Modifications Copyright (C) 2020 Nordix Foundation
-%%
-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===================================
-]]>-->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.o-ran-sc.portal.nonrtric.controlpanel</groupId>
- <artifactId>nonrtric-controlpanel-parent</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- </parent>
- <artifactId>nonrtric-controlpanel-be</artifactId>
- <name>Non-RT RIC Control Panel Webapp backend</name>
- <properties>
- <epsdk-fw.version>2.6.0</epsdk-fw.version>
- <springfox.version>2.9.2</springfox.version>
- <immutable.version>2.7.1</immutable.version>
- <apache-axis2.version>1.7.9</apache-axis2.version>
- <formatter-maven-plugin.version>2.8.1</formatter-maven-plugin.version>
- <spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
- <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
- <docker-maven-plugin.version>0.33.0</docker-maven-plugin.version>
- <json.version>20190722</json.version>
- <!-- Set by Jenkins -->
- <build.number>0</build.number>
- </properties>
- <repositories>
- <repository>
- <id>onap-releases</id>
- <name>ONAP - Release Repository</name>
- <url>https://nexus.onap.org/content/repositories/releases</url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-webflux</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>${apache-axis2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- Bridge uses of Apache commons logging, like EPSDK-FW -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox.version}</version>
- </dependency>
- <dependency>
- <groupId>org.immutables</groupId>
- <artifactId>value</artifactId>
- <version>${immutable.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.immutables</groupId>
- <artifactId>gson</artifactId>
- <version>${immutable.version}</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>${json.version}</version>
- </dependency>
- <!-- Test dependencies -->
- <!-- Mockito supports development, not just testing -->
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-launcher</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>mockwebserver</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/generated-sources/annotations/</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>net.revelc.code.formatter</groupId>
- <artifactId>formatter-maven-plugin</artifactId>
- <version>${formatter-maven-plugin.version}</version>
- <configuration>
- <configFile>${project.basedir}/eclipse-formatter.xml</configFile>
- </configuration>
- <!-- https://code.revelc.net/formatter-maven-plugin/ use
- mvn formatter:format spotless:apply process-sources -->
- </plugin>
- <plugin>
- <groupId>com.diffplug.spotless</groupId>
- <artifactId>spotless-maven-plugin</artifactId>
- <version>${spotless-maven-plugin.version}</version>
- <configuration>
- <java>
- <removeUnusedImports />
- <importOrder>
- <order>com,java,javax,org</order>
- </importOrder>
- </java>
- </configuration>
- <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven
- use mvn spotless:apply to rewrite source files use mvn spotless:check to
- validate source files -->
- </plugin>
- <!-- Add the build number to the jar manifest. Spring-Boot uses a complex
- packaging process that makes access to the original Manifest.MF very difficult.
- However, Java provides access to the implementation version for a package,
- so cram the build number into there. -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- <manifestEntries>
- <Implementation-Version>${project.version}-b${build.number}</Implementation-Version>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- <!-- do not deploy a jar or pom file -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>${jacoco-maven-plugin.version}</version>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- https://stackoverflow.com/questions/39126226/fabric8-springboot-full-example -->
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>${docker-maven-plugin.version}</version>
- <configuration>
- <verbose>true</verbose>
- <!-- environment variables supplied by Jenkins -->
- <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>
- <pushRegistry>${env.CONTAINER_PUSH_REGISTRY}</pushRegistry>
- <images>
- <image>
- <!-- Specify a tag to avoid default tag "latest" -->
- <!-- Avoid maven artifact name here -->
- <name>o-ran-sc/nonrtric-controlpanel-backend:${project.version}</name>
- <build>
- <from>openjdk:11-jre-slim</from>
- <tags>
- <!-- Add tag with build number -->
- <tag>${project.version}</tag>
- </tags>
- <assembly>
- <descriptorRef>artifact</descriptorRef>
- </assembly>
- <runCmds>
- <!-- Ensure logs dir exists and is world writable -->
- <runCmd>mkdir /logs</runCmd>
- <runCmd>chmod -R 777 /logs</runCmd>
- </runCmds>
- <cmd>
- <!-- Include maven dir on classpath for prop files -->
- <exec>
- <arg>java</arg>
- <arg>-Xms128m</arg>
- <arg>-Xmx256m</arg>
- <arg>-cp</arg>
- <arg>maven:maven/${project.artifactId}-${project.version}.${project.packaging}</arg>
- <arg>-Dloader.main=org.oransc.portal.nonrtric.controlpanel.ControlPanelApplication</arg>
- <arg>-Djava.security.egd=file:/dev/./urandom</arg>
- <arg>org.springframework.boot.loader.PropertiesLauncher</arg>
- </exec>
- </cmd>
- </build>
- </image>
- </images>
- </configuration>
- <!-- build Docker images in install phase, push in deploy phase -->
- <executions>
- <execution>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel;
-
-import java.lang.invoke.MethodHandles;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-
-@SpringBootApplication
-// Limit scan to controlpanel classes; exclude generated API classes
-@ComponentScan("org.oransc.portal.nonrtric.controlpanel")
-public class ControlPanelApplication {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- public static void main(String[] args) {
- SpringApplication.run(ControlPanelApplication.class);
- // Ensure this appears on the console by using level WARN
- logger.warn("main: version '{}' successful start",
- getImplementationVersion(MethodHandles.lookup().lookupClass()));
- }
-
- /**
- * Gets version details for the specified class.
- *
- * @param clazz Class to get the version
- *
- * @return the value of the MANIFEST.MF property Implementation-Version as
- * written by maven when packaged in a jar; 'unknown' otherwise.
- */
- public static String getImplementationVersion(Class<?> clazz) {
- String classPath = clazz.getResource(clazz.getSimpleName() + ".class").toString();
- return classPath.startsWith("jar") ? clazz.getPackage().getImplementationVersion() : "unknown-not-jar";
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel;
-
-public abstract class ControlPanelConstants {
-
- private ControlPanelConstants() {
- // Sonar insists on hiding the constructor
- }
-
- public static final String ENDPOINT_PREFIX = "/api";
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.config;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-/**
- * Allows non-Spring-managed classes to obtain the Spring application context.
- */
-@Component
-public class SpringContextCache implements ApplicationContextAware {
-
- private ApplicationContext applicationContext = null;
-
- @Override
- public void setApplicationContext(final ApplicationContext appContext) {
- applicationContext = appContext;
- }
-
- public ApplicationContext getApplicationContext() {
- return applicationContext;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.config;
-
-import org.oransc.portal.nonrtric.controlpanel.ControlPanelApplication;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-/**
- * http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
- */
-@Configuration
-@EnableSwagger2
-public class SwaggerConfiguration {
-
- /**
- * @return new Docket
- */
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2).select() //
- .apis(RequestHandlerSelectors.basePackage(ControlPanelApplication.class.getPackage().getName())) //
- .paths(PathSelectors.any()) //
- .build() //
- .apiInfo(apiInfo());
- }
-
- private ApiInfo apiInfo() {
- final String version = ControlPanelApplication.class.getPackage().getImplementationVersion();
- return new ApiInfoBuilder() //
- .title("Non-RT RIC Control Panel backend") //
- .description("Proxies access to Near-RT RIC.")//
- .termsOfServiceUrl("Terms of service") //
- .contact(new Contact("Non-RT RIC Control Panel Dev Team", //
- "http://no-docs-yet.org/", //
- "noreply@O-RAN-SC.org")) //
- .license("Apache 2.0 License").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0") //
- .version(version == null ? "version not available" : version) //
- .build();
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.config;
-
-import java.lang.invoke.MethodHandles;
-
-import org.apache.catalina.connector.Connector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
-import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class TomcatWebServerConfiguration {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @Value("${server.http.port}")
- private int httpPort;
-
- @Bean
- public ServletWebServerFactory servletContainer() {
- logger.debug("Http Port: {}", httpPort);
- TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
- if (httpPort > 0) {
- tomcat.addAdditionalTomcatConnectors(getHttpConnector(httpPort));
- }
- return tomcat;
- }
-
- private static Connector getHttpConnector(int port) {
- Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
- connector.setScheme("http");
- connector.setPort(port);
- connector.setSecure(false);
- return connector;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import java.lang.invoke.MethodHandles;
-
-import org.oransc.portal.nonrtric.controlpanel.model.ErrorTransport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.client.HttpStatusCodeException;
-import org.springframework.web.client.RestClientResponseException;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
-
-/**
- * Catches certain exceptions. This controller advice factors out try-catch
- * blocks in many controller methods.
- *
- * Also see:<br>
- * https://www.baeldung.com/exception-handling-for-rest-with-spring
- * https://www.springboottutorial.com/spring-boot-exception-handling-for-rest-services
- */
-@ControllerAdvice
-public class CustomResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
-
- // Superclass has "logger" that is exposed here, so use a different name
- private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- /**
- * Logs the error and generates a JSON response when a REST controller method
- * takes a RestClientResponseException. This is thrown by the Http client when a
- * remote method returns a non-2xx code. All the controller methods are proxies
- * in that they just forward the request along to a remote system, so if that
- * remote system fails, return 502 plus some details about the failure, rather
- * than the generic 500 that Spring-Boot will return on an uncaught exception.
- *
- * Why 502? I quote: <blockquote>HTTP server received an invalid response from a
- * server it consulted when acting as a proxy or gateway.</blockquote>
- *
- * @param ex
- * The exception
- *
- * @param request
- * The original request
- *
- * @return A response entity with status code 502 plus some details in the body.
- */
- @ExceptionHandler({RestClientResponseException.class})
- public final ResponseEntity<ErrorTransport> handleProxyMethodException(Exception ex, WebRequest request) {
- // Capture the full stack trace in the log.
- log.error("handleProxyMethodException: request {}, exception {}", request.getDescription(false),
- ex.getMessage());
- if (ex instanceof HttpStatusCodeException) {
- HttpStatusCodeException hsce = (HttpStatusCodeException) ex;
- return new ResponseEntity<>(new ErrorTransport(hsce.getRawStatusCode(), hsce.getResponseBodyAsString(),
- ex.toString(), request.getDescription(false)), HttpStatus.BAD_GATEWAY);
- } else {
- return new ResponseEntity<>(new ErrorTransport(500, ex), HttpStatus.BAD_GATEWAY);
- }
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import io.swagger.annotations.ApiOperation;
-
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.oransc.portal.nonrtric.controlpanel.ControlPanelConstants;
-import org.oransc.portal.nonrtric.controlpanel.eiproducerapi.EiProducerApi;
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo.ProducerEiTypeRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerStatusInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.Assert;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Proxies calls from the front end to the EI Producer API.
- *
- * If a method throws RestClientResponseException, it is handled by
- * {@link CustomResponseEntityExceptionHandler#handleProxyMethodException(Exception, org.springframework.web.context.request.WebRequest)}
- * which returns status 502. All other exceptions are handled by Spring which
- * returns status 500.
- */
-@RestController
-@RequestMapping(value = EnrichmentController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
-public class EnrichmentController {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- // Publish paths in constants so tests are easy to write
- public static final String CONTROLLER_PATH = ControlPanelConstants.ENDPOINT_PREFIX + "/enrichment";
- // Endpoints
- public static final String EI_TYPES = "eitypes";
- public static final String EI_PRODUCERS = "eiproducers";
- public static final String EI_JOBS = "eijobs";
- public static final String EI_TYPE_ID = "ei_type_id";
- public static final String EI_PRODUCER_ID = "ei_producer_id";
- public static final String STATUS = "status";
-
- // Populated by the autowired constructor
- private final EiProducerApi eiProducerApi;
- public static com.google.gson.Gson gson = new GsonBuilder().create();
-
- @Autowired
- public EnrichmentController(final EiProducerApi eiProducerApi) {
- Assert.notNull(eiProducerApi, "API must not be null");
- this.eiProducerApi = eiProducerApi;
- logger.debug("enrichment: configured with client type {}", eiProducerApi.getClass().getName());
- }
-
- @ApiOperation(value = "Get the EI job definitions for one EI producer")
- @GetMapping(EI_JOBS)
- public ResponseEntity<String> getEiJobs() {
- logger.debug("getEiJobs");
- ResponseEntity<String> response = this.eiProducerApi.getAllEiProducerIds();
- JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray();
- List<JobInfo> allJobs = new ArrayList<>();
- for (JsonElement producerId : bodyJson) {
- allJobs.addAll(getJobs(producerId));
- }
- return new ResponseEntity<>(gson.toJson(allJobs), HttpStatus.OK);
- }
-
- private List<JobInfo> getJobs(JsonElement producerId) {
- ResponseEntity<List<JobInfo>> jobsResponse =
- this.eiProducerApi.getEiJobsForOneEiProducer(producerId.getAsString());
- return jobsResponse.getBody();
- }
-
- @ApiOperation(value = "Get EI producers")
- @GetMapping(EI_PRODUCERS)
- public ResponseEntity<String> getEiProducers() {
- logger.debug("getEiProducers");
- ResponseEntity<String> response = this.eiProducerApi.getAllEiProducerIds();
- JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray();
- List<ProducerInfo> producers = new ArrayList<>();
- for (JsonElement producerId : bodyJson) {
- ProducerInfo producerInfo = ProducerInfo.builder() //
- .id(producerId.getAsString()) //
- .types(getSupportedTypes(producerId)) //
- .status(getProducerStatus(producerId)) //
- .build();
- producers.add(producerInfo);
- }
-
- return new ResponseEntity<>(gson.toJson(producers), HttpStatus.OK);
- }
-
- private String[] getSupportedTypes(JsonElement producerId) {
- ResponseEntity<ProducerRegistrationInfo> producerResponse =
- this.eiProducerApi.getEiProducer(producerId.getAsString());
- List<String> supportedTypes = new ArrayList<>();
- for (ProducerEiTypeRegistrationInfo type : producerResponse.getBody().types) {
- supportedTypes.add(type.eiTypeId);
- }
- return supportedTypes.toArray(new String[0]);
- }
-
- private String getProducerStatus(JsonElement producerId) {
- ResponseEntity<ProducerStatusInfo> statusResponse =
- this.eiProducerApi.getEiProducerStatus(producerId.getAsString());
- return statusResponse.getBody().opState.toString();
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-
-/**
- * Listens for requests to known Angular routes.
- */
-@Controller
-public class Html5PathsController {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- /**
- * Forwards the browser to the index (main) page upon request of a known route.
- * This unfortunately requires duplication of the Angular route strings in the
- * path mappings on this method. Could switch to a regex pattern instead someday
- * if the routes change too often.
- *
- * https://stackoverflow.com/questions/44692781/configure-spring-boot-to-redirect-404-to-a-single-page-app
- *
- * @param request
- * HttpServletRequest
- * @param response
- * HttpServletResponse
- * @throws IOException
- * On error
- */
- @GetMapping("/policy")
- public void forwardAngularRoutes(HttpServletRequest request, HttpServletResponse response) throws IOException {
- URL url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "/index.html");
- if (logger.isDebugEnabled())
- logger.debug("forwardAngularRoutes: {} redirected to {}", request.getRequestURI(), url);
- response.sendRedirect(url.toString());
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import io.swagger.annotations.ApiOperation;
-
-import java.lang.invoke.MethodHandles;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.oransc.portal.nonrtric.controlpanel.ControlPanelConstants;
-import org.oransc.portal.nonrtric.controlpanel.policyagentapi.PolicyAgentApi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.Assert;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Proxies calls from the front end to the Policy Agent API.
- *
- * If a method throws RestClientResponseException, it is handled by
- * {@link CustomResponseEntityExceptionHandler#handleProxyMethodException(Exception, org.springframework.web.context.request.WebRequest)}
- * which returns status 502. All other exceptions are handled by Spring which
- * returns status 500.
- */
-@RestController
-@RequestMapping(value = PolicyController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
-public class PolicyController {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- // Publish paths in constants so tests are easy to write
- public static final String CONTROLLER_PATH = ControlPanelConstants.ENDPOINT_PREFIX + "/policy";
- // Endpoints
- public static final String POLICY_TYPES_METHOD = "policytypes";
- public static final String POLICY_TYPE_PARAM = "type";
- public static final String POLICIES_NAME = "policies";
- public static final String POLICY_INSTANCE_ID_NAME = "policy_instance_id";
-
- // Populated by the autowired constructor
- private final PolicyAgentApi policyAgentApi;
-
- @Autowired
- public PolicyController(final PolicyAgentApi policyAgentApi) {
- Assert.notNull(policyAgentApi, "API must not be null");
- this.policyAgentApi = policyAgentApi;
- logger.debug("ctor: configured with client type {}", policyAgentApi.getClass().getName());
- }
-
- /*
- * The fields are defined in the Policy Control Typescript interface.
- */
- @ApiOperation(value = "Gets the policy types from Near-RT RIC")
- @GetMapping(POLICY_TYPES_METHOD)
- public ResponseEntity<String> getAllPolicyTypes(HttpServletResponse response) {
- logger.debug("getAllPolicyTypes");
- return this.policyAgentApi.getAllPolicyTypes();
- }
-
- @ApiOperation(value = "Returns the policy instances for the given policy type.")
- @GetMapping(POLICIES_NAME)
- public ResponseEntity<String> getPolicyInstances(
- @RequestParam(name = "type", required = true) String policyTypeIdString) {
- logger.debug("getPolicyInstances {}", policyTypeIdString);
- return this.policyAgentApi.getPolicyInstancesForType(policyTypeIdString);
- }
-
- @ApiOperation(value = "Returns a policy instance")
- @GetMapping(POLICIES_NAME + "/{" + POLICY_INSTANCE_ID_NAME + "}")
- public ResponseEntity<Object> getPolicyInstance(@PathVariable(POLICY_INSTANCE_ID_NAME) String policyInstanceId) {
- logger.debug("getPolicyInstance {}", policyInstanceId);
- return this.policyAgentApi.getPolicyInstance(policyInstanceId);
- }
-
- @ApiOperation(value = "Creates the policy instances for the given policy type.")
- @PutMapping(POLICIES_NAME + "/{" + POLICY_INSTANCE_ID_NAME + "}")
- public ResponseEntity<String> putPolicyInstance( //
- @RequestParam(POLICY_TYPE_PARAM) String policyTypeIdString, //
- @RequestParam(name = "ric", required = true) String ric, //
- @PathVariable(POLICY_INSTANCE_ID_NAME) String policyInstanceId, //
- @RequestBody String instance) {
- logger.debug("putPolicyInstance ric: {}, typeId: {}, instanceId: {}, instance: {}", ric, policyTypeIdString,
- policyInstanceId, instance);
- return this.policyAgentApi.putPolicy(policyTypeIdString, policyInstanceId, instance, ric);
- }
-
- @ApiOperation(value = "Deletes the policy instances for the given policy type.")
- @DeleteMapping(POLICIES_NAME + "/{" + POLICY_INSTANCE_ID_NAME + "}")
- public ResponseEntity<String> deletePolicyInstance( //
- @RequestParam(POLICY_TYPE_PARAM) String policyTypeIdString,
- @PathVariable(POLICY_INSTANCE_ID_NAME) String policyInstanceId) {
- logger.debug("deletePolicyInstance typeId: {}, instanceId: {}", policyTypeIdString, policyInstanceId);
- return this.policyAgentApi.deletePolicy(policyInstanceId);
- }
-
- @ApiOperation(value = "Returns the rics supporting the given policy type.")
- @GetMapping("/rics")
- public ResponseEntity<String> getRicsSupportingType(
- @RequestParam(name = "policyType", required = true) String supportingPolicyType) {
- logger.debug("getRicsSupportingType {}", supportingPolicyType);
-
- return this.policyAgentApi.getRicsSupportingType(supportingPolicyType);
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import java.lang.invoke.MethodHandles;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.servlet.error.ErrorAttributes;
-import org.springframework.boot.web.servlet.error.ErrorController;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.context.request.ServletWebRequest;
-import springfox.documentation.annotations.ApiIgnore;
-
-/**
- * Provides a controller which is invoked on any error within the Spring-managed
- * context, including page not found, and redirects the caller to a custom error
- * page. The caller is also redirected to this page if a REST controller takes
- * an uncaught exception.
- *
- * If trace is requested via request parameter ("?trace=true") and available,
- * adds stack trace information to the standard JSON error response.
- *
- * Excluded from Swagger API documentation.
- *
- * https://stackoverflow.com/questions/25356781/spring-boot-remove-whitelabel-error-page
- * https://www.baeldung.com/spring-boot-custom-error-page
- */
-
-@ApiIgnore
-@Controller
-@RequestMapping(value = SimpleErrorController.ERROR_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
-public class SimpleErrorController implements ErrorController {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @SuppressWarnings("squid:S1075") // URIs should not be hardcoded
- public static final String ERROR_PATH = "/error";
-
- private final ErrorAttributes errorAttributes;
-
- @Autowired
- public SimpleErrorController(ErrorAttributes errorAttributes) {
- this.errorAttributes = errorAttributes;
- }
-
- @Override
- public String getErrorPath() {
- logger.warn("getErrorPath");
- return ERROR_PATH;
- }
-
- @GetMapping
- public String handleError(HttpServletRequest request) {
- ServletWebRequest servletWebRequest = new ServletWebRequest(request);
- Throwable t = errorAttributes.getError(servletWebRequest);
- if (t != null)
- logger.warn("handleError", t);
- Map<String, Object> attributes = errorAttributes.getErrorAttributes(servletWebRequest, true);
- attributes.forEach((attribute, value) -> logger.warn("handleError: {} -> {}", attribute, value));
- // Return the name of the page INCLUDING suffix, which I guess is a "view" name.
- // Just "error" is not enough, but don't seem to need a ModelAndView object.
- return "error.html";
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.eiproducerapi;
-
-import java.util.List;
-
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerStatusInfo;
-import org.springframework.http.ResponseEntity;
-
-public interface EiProducerApi {
-
- public ResponseEntity<String> getAllEiProducerIds();
-
- public ResponseEntity<ProducerRegistrationInfo> getEiProducer(String eiProducerId);
-
- public ResponseEntity<List<JobInfo>> getEiJobsForOneEiProducer(String eiProducerId);
-
- public ResponseEntity<ProducerStatusInfo> getEiProducerStatus(String eiProducerId);
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.eiproducerapi;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonSyntaxException;
-
-import java.lang.invoke.MethodHandles;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerStatusInfo;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.oransc.portal.nonrtric.controlpanel.util.ErrorResponseHandler;
-import org.oransc.portal.nonrtric.controlpanel.util.JsonArrayHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
-
-@Component("EiProducerApi")
-public class EiProducerApiImpl implements EiProducerApi {
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private static final String EI_PRODUCERS = "/eiproducers";
- private static final String EI_JOBS = "/eijobs";
- private static final String STATUS = "/status";
-
- private final AsyncRestClient webClient;
- private static com.google.gson.Gson gson = new GsonBuilder().create();
-
- @Autowired
- public EiProducerApiImpl(
- @org.springframework.beans.factory.annotation.Value("${enrichmentcontroller.url.prefix}") final String urlPrefix) {
- this(new AsyncRestClient(urlPrefix));
- logger.debug("enrichment controller url prefix '{}'", urlPrefix);
- }
-
- public EiProducerApiImpl(AsyncRestClient webClient) {
- this.webClient = webClient;
- }
-
- @Override
- public ResponseEntity<String> getAllEiProducerIds() {
- return getResponseArray(EI_PRODUCERS);
- }
-
- @Override
- public ResponseEntity<ProducerRegistrationInfo> getEiProducer(String eiProducerId) throws JsonSyntaxException {
- ResponseEntity<String> resp = getResponseObject(EI_PRODUCERS + "/" + eiProducerId);
- ProducerRegistrationInfo info = gson.fromJson(resp.getBody(), ProducerRegistrationInfo.class);
- return new ResponseEntity<>(info, resp.getStatusCode());
- }
-
- @Override
- public ResponseEntity<List<JobInfo>> getEiJobsForOneEiProducer(String eiProducerId)
- throws JsonSyntaxException, IllegalStateException {
- ResponseEntity<String> resp = getResponseArray(EI_PRODUCERS + "/" + eiProducerId + EI_JOBS);
- List<JobInfo> jobs = JsonArrayHandler.parseJsonArray(resp.getBody(), JobInfo.class);
- return new ResponseEntity<>(jobs, resp.getStatusCode());
- }
-
- @Override
- public ResponseEntity<ProducerStatusInfo> getEiProducerStatus(String eiProducerId) throws JsonSyntaxException {
- ResponseEntity<String> resp = getResponseObject(EI_PRODUCERS + "/" + eiProducerId + STATUS);
- ProducerStatusInfo status = gson.fromJson(resp.getBody(), ProducerStatusInfo.class);
- return new ResponseEntity<>(status, resp.getStatusCode());
- }
-
- private ResponseEntity<String> getResponseArray(String url) {
- try {
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return rsp;
- }
- return new ResponseEntity<>(new JSONArray(rsp.getBody()).toString(), rsp.getStatusCode());
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-
- private ResponseEntity<String> getResponseObject(String url) {
- try {
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return rsp;
- }
- return new ResponseEntity<>(new JSONObject(rsp.getBody()).toString(), rsp.getStatusCode());
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.k8sapi;
-
-import java.lang.invoke.MethodHandles;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.DefaultUriBuilderFactory;
-
-/**
- * Provides a method to get a list of pods using RestTemplate. As currently
- * configured this uses the default JVM HTTPS support which can be configured to
- * ignore errors as a workaround for self-signed SSL certificates.
- */
-public class SimpleKubernetesClient {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private final String k8sUrl;
-
- public SimpleKubernetesClient(String baseUrl) {
- logger.debug("ctor: baseUrl {}", baseUrl);
- k8sUrl = baseUrl;
- }
-
- public String listPods(String namespace) {
- logger.debug("listPods for namespace {}", namespace);
- String podsUrl = new DefaultUriBuilderFactory(k8sUrl.trim()).builder().pathSegment("v1")
- .pathSegment("namespaces").pathSegment(namespace.trim()).pathSegment("pods").build().normalize().toString();
- RestTemplate rt = new RestTemplate();
- ResponseEntity<String> podsResponse = rt.getForEntity(podsUrl, String.class);
- return podsResponse.getBody();
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import java.time.Instant;
-
-/**
- * This mimics the model Spring-Boot uses for a message returned on failure, to
- * be serialized as JSON.
- */
-public class ErrorTransport implements IControlPanelResponse {
-
- private Instant timestamp;
- private Integer status;
- private String error;
- private String message;
- private String path;
-
- /**
- * Builds an empty object.
- */
- public ErrorTransport() {
- // no-arg constructor
- }
-
- /**
- * Convenience constructor for minimal value set.
- *
- * @param status
- * Integer value like 400
- * @param error
- * Error message
- */
- public ErrorTransport(int status, String error) {
- this(status, error, null, null);
- }
-
- /**
- * Convenience constructor for populating an error from an exception
- *
- * @param status
- * Integer value like 400
- * @param throwable
- * The caught exception/throwable to convert to String with
- * an upper bound on characters
- */
- public ErrorTransport(int status, Throwable throwable) {
- this.timestamp = Instant.now();
- this.status = status;
- final int enough = 256;
- String exString = throwable.toString();
- this.error = exString.length() > enough ? exString.substring(0, enough) : exString;
- }
-
- /**
- * Builds an object with all fields
- *
- * @param status
- * Integer value like 500
- * @param error
- * Explanation
- * @param message
- * Additional explanation
- * @param path
- * Requested path
- */
- public ErrorTransport(int status, String error, String message, String path) {
- this.timestamp = Instant.now();
- this.status = status;
- this.error = error;
- this.message = message;
- this.path = path;
- }
-
- public Integer getStatus() {
- return status;
- }
-
- public void setStatus(Integer status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String error) {
- this.message = error;
- }
-
- public Instant getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Instant timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getError() {
- return error;
- }
-
- public void setError(String error) {
- this.error = error;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-/**
- * Marker interface used by all transport models.
- */
-public interface IControlPanelResponse {
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@ApiModel(value = "ei_job_request", description = "The EI job")
-@Builder
-public class JobInfo {
-
- @ApiModelProperty(value = "Identity of the EI job", required = true)
- @SerializedName("ei_job_identity")
- public String id;
-
- @ApiModelProperty(value = "Type identity for the job")
- @SerializedName("ei_type_identity")
- public String typeId;
-
- @ApiModelProperty(value = "Json for the job data")
- @SerializedName("ei_job_data")
- public Object jobData;
-
- @ApiModelProperty(value = "URI for the target of the EI")
- @SerializedName("target_uri")
- public String targetUri;
-
- @ApiModelProperty(value = "The owner of the job")
- @SerializedName("owner")
- public String owner;
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@Builder
-public class PolicyInfo {
- @SerializedName(value = "id", alternate = "policy_id")
- public String policyId;
-
- @SerializedName(value = "type", alternate = "policytype_id")
- public String policyTypeId;
-
- @SerializedName(value = "ric", alternate = "ric_id")
- public String ricId;
-
- @SerializedName(value = "json", alternate = "policy_data")
- public Object policyData;
-
- @SerializedName(value = "service", alternate = "service_id")
- public String serviceId;
-
- @SerializedName("transient")
- public boolean isTransient = false;
-
- @SerializedName(value = "statusNotificationUri", alternate = "status_notification_uri")
- public String statusNotificationUri = "";
-
- @SerializedName("lastModified")
- public String lastModified = "";
-
- public boolean validate() {
- return policyId != null && policyTypeId != null && ricId != null && policyData != null && serviceId != null;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@Builder
-public class PolicyInstance {
-
- @SerializedName(value = "policy_id")
- public String policyId;
-
- @SerializedName(value = "policytype_id")
- public String policyTypeId;
-
- @SerializedName(value = "ric_id")
- public String ricId;
-
- @SerializedName(value = "policy_data")
- public Object policyData;
-
- @SerializedName(value = "service_id")
- public String serviceId;
-
- @SerializedName(value = "transient")
- public boolean isTransient = false;
-
- @SerializedName(value = "status_notification_uri")
- public String statusNotificationUri = "";
-
- @SerializedName(value = "lastModified")
- public String lastModified = "";
-
- public boolean validate() {
- return policyId != null && policyTypeId != null && ricId != null && policyData != null && serviceId != null;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import java.util.ArrayList;
-
-public class PolicyInstances extends ArrayList<PolicyInfo> {
-
- private static final long serialVersionUID = -928428052502491021L;
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-public class PolicyType {
-
- String name;
-
- Object schema;
-
- public PolicyType(String name, Object schema) {
- this.name = name;
- this.schema = schema;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Object getSchema() {
- return schema;
- }
-
- public void setSchema(Object schema) {
- this.schema = schema;
- }
-
- @Override
- public String toString() {
- return "[name:" + name + ", schema:" + schema.toString() + "]";
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import java.util.ArrayList;
-
-public class PolicyTypes extends ArrayList<PolicyType> {
-
- private static final long serialVersionUID = -928428052502491021L;
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.
- * ======================================================================
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@ApiModel(value = "ei_producer", description = "The EI producer")
-@Builder
-public class ProducerInfo {
-
- @ApiModelProperty(value = "Idenitity of the EI producer", required = true)
- @SerializedName("ei_producer_id")
- public String id;
-
- @ApiModelProperty(value = "Types provided by the EI producer", required = true)
- @SerializedName("ei_producer_types")
- public String[] types;
-
- @ApiModelProperty(value = "Status of the EI producer", required = true)
- @SerializedName("status")
- public String status;
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.util.Collection;
-
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@ApiModel(value = "producer_registration_info", description = "Information for an EI producer")
-@Builder
-public class ProducerRegistrationInfo {
-
- @Gson.TypeAdapters
- @ApiModel(value = "producer_ei_type_registration_info", description = "Information for an EI type")
- @Builder
- public static class ProducerEiTypeRegistrationInfo {
-
- @ApiModelProperty(value = "EI type identity", required = true)
- @SerializedName("ei_type_identity")
- public String eiTypeId;
-
- @ApiModelProperty(value = "Json schema for the job data")
- @SerializedName("ei_job_data_schema")
- public Object jobDataSchema;
- }
-
- @ApiModelProperty(value = "Supported EI types", required = true)
- @SerializedName("supported_ei_types")
- public Collection<ProducerEiTypeRegistrationInfo> types;
-
- @ApiModelProperty(value = "callback for EI job", required = true)
- @SerializedName("ei_job_callback_url")
- public String jobCallbackUrl;
-
- @ApiModelProperty(value = "callback for producer supervision", required = true)
- @SerializedName("ei_producer_supervision_callback_url")
- public String producerSupervisionCallbackUrl;
-
- @ApiModelProperty(value = "status", required = true)
- @SerializedName("status")
- public ProducerStatusInfo status;
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-import com.google.gson.annotations.SerializedName;
-
-import lombok.Builder;
-
-import org.immutables.gson.Gson;
-
-@Gson.TypeAdapters
-@Builder
-public class ProducerStatusInfo {
-
- @Gson.TypeAdapters
- public enum OperationalState {
- ENABLED, DISABLED
- }
-
- @SerializedName("operational_state")
- public final OperationalState opState;
-
- public ProducerStatusInfo(OperationalState state) {
- this.opState = state;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.model;
-
-public class SuccessTransport implements IControlPanelResponse {
-
- private int status;
- private Object data;
-
- /**
- * Builds an empty object
- */
- public SuccessTransport() {
- // no-arg constructor
- }
-
- /**
- * Builds an object with the specified values.
- *
- * @param status
- * Status code
- * @param data
- * Data to transport
- */
- public SuccessTransport(int status, Object data) {
- this.status = status;
- this.data = data;
- }
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public Object getData() {
- return data;
- }
-
- public void setData(Object data) {
- this.data = data;
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.policyagentapi;
-
-import org.springframework.http.ResponseEntity;
-
-public interface PolicyAgentApi {
-
- public ResponseEntity<String> getAllPolicyTypes();
-
- public ResponseEntity<String> getPolicyInstancesForType(String type);
-
- public ResponseEntity<Object> getPolicyInstance(String id);
-
- public ResponseEntity<String> putPolicy(String policyTypeIdString, String policyInstanceId, Object json,
- String ric);
-
- public ResponseEntity<String> deletePolicy(String policyInstanceId);
-
- public ResponseEntity<String> getRicsSupportingType(String typeName);
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.policyagentapi;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.google.gson.reflect.TypeToken;
-
-import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.immutables.gson.Gson;
-import org.immutables.value.Value;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInstance;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyType;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyTypes;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.oransc.portal.nonrtric.controlpanel.util.ErrorResponseHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
-
-@Component("PolicyAgentApi")
-public class PolicyAgentApiImpl implements PolicyAgentApi {
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private final AsyncRestClient webClient;
-
- private static com.google.gson.Gson gson = new GsonBuilder() //
- .serializeNulls() //
- .create(); //
-
- @Autowired
- public PolicyAgentApiImpl(
- @org.springframework.beans.factory.annotation.Value("${policycontroller.url.prefix}") final String urlPrefix) {
- this(new AsyncRestClient(urlPrefix));
- logger.debug("ctor prefix '{}'", urlPrefix);
- }
-
- public PolicyAgentApiImpl(AsyncRestClient webClient) {
- this.webClient = webClient;
- }
-
- @Override
- public ResponseEntity<String> getAllPolicyTypes() {
- try {
- final String url = "/a1-policy/v2/policy-types";
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return rsp;
- }
-
- PolicyTypes result = new PolicyTypes();
- JsonArray policyTypeIds = JsonParser.parseString(rsp.getBody()).getAsJsonObject() //
- .get("policytype_ids") //
- .getAsJsonArray(); //
-
- for (JsonElement policyTypeId : policyTypeIds) {
-
- String typeId = policyTypeId.getAsString();
-
- JsonObject schemaObj = getIndividualPolicySchema(typeId);
- PolicyType pt = new PolicyType(typeId, schemaObj.toString());
- result.add(pt);
- }
- return new ResponseEntity<>(gson.toJson(result), rsp.getStatusCode());
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-
- public JsonObject getIndividualPolicySchema(String id) {
- try {
- final String url = "/a1-policy/v2/policy-types/" + id;
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return null;
- }
-
- JsonObject policy_schema = JsonParser.parseString(rsp.getBody()).getAsJsonObject() //
- .get("policy_schema") //
- .getAsJsonObject(); //
-
- return policy_schema;
- } catch (Exception e) {
- return null;
- }
- }
-
- @Override
- public ResponseEntity<String> getPolicyInstancesForType(String type) {
- try {
- String url = "/a1-policy/v2/policies?policytype_id=" + type;
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return rsp;
- }
- JsonArray policyInstances = JsonParser.parseString(rsp.getBody()).getAsJsonObject() //
- .get("policy_ids") //
- .getAsJsonArray(); //
-
- List<Object> res = new ArrayList<>();
- for (JsonElement p : policyInstances) {
- ResponseEntity<Object> policyInstance = getIndividualPolicyInstance(p.getAsString());
- res.add(policyInstance.getBody());
- }
-
- return new ResponseEntity<>(gson.toJson(res), rsp.getStatusCode());
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-
- public ResponseEntity<Object> getIndividualPolicyInstance(String id) {
- try {
- String url = "/a1-policy/v2/policies/" + id;
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- JsonObject obj = JsonParser.parseString(rsp.getBody()).getAsJsonObject();
-
- // lastModified timestamp is fetched from PolicyStatus instead
- ResponseEntity<String> status = getPolicyStatus(id);
- String lastModified = JsonParser.parseString(status.getBody()).getAsJsonObject() //
- .get("last_modified") //
- .getAsString(); //
- obj.addProperty("lastModified", lastModified);
-
- PolicyInfo i = gson.fromJson(obj, PolicyInfo.class);
- return new ResponseEntity<>(i, rsp.getStatusCode());
- } catch (Exception e) {
- ResponseEntity<String> rsp = ErrorResponseHandler.handleException(e);
- return new ResponseEntity<>(rsp.getBody(), rsp.getStatusCode());
- }
- }
-
- public ResponseEntity<String> getPolicyStatus(String id) {
- try {
- String url = "/a1-policy/v2/policies/" + id + "/status";
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- return new ResponseEntity<>(rsp.getBody(), rsp.getStatusCode());
- } catch (Exception e) {
- ResponseEntity<String> rsp = ErrorResponseHandler.handleException(e);
- return new ResponseEntity<>(rsp.getBody(), rsp.getStatusCode());
- }
- }
-
- @Override
- public ResponseEntity<Object> getPolicyInstance(String id) {
- ResponseEntity<Object> rsp = getIndividualPolicyInstance(id);
- PolicyInfo i = (PolicyInfo) rsp.getBody();
- return new ResponseEntity<>(i.policyData, rsp.getStatusCode());
- }
-
- @Override
- public ResponseEntity<String> putPolicy(String policyTypeIdString, String policyInstanceId, Object json,
- String ric) {
- String url = "/a1-policy/v2/policies/";
-
- JsonElement data = JsonParser.parseString(json.toString()).getAsJsonObject();
-
- PolicyInstance i = PolicyInstance.builder() //
- .policyId(policyInstanceId) //
- .policyTypeId(policyTypeIdString) //
- .ricId(ric) //
- .policyData(data) //
- .serviceId("controlpanel") //
- .build(); //
-
- try {
- String jsonStr = gson.toJson(i, PolicyInstance.class);
- logger.debug("PolicyInstance: " + jsonStr);
- webClient.putForEntity(url, jsonStr).block();
- return new ResponseEntity<>(HttpStatus.OK);
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-
- @Override
- public ResponseEntity<String> deletePolicy(String policyInstanceId) {
- String url = "/a1-policy/v2/policies/" + policyInstanceId;
- try {
- webClient.deleteForEntity(url).block();
- return new ResponseEntity<>(HttpStatus.OK);
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-
- @Value.Immutable
- @Gson.TypeAdapters
- interface RicInfo {
- public String ric_id();
-
- public Collection<String> managed_element_ids();
-
- public Collection<String> policytype_ids();
- }
-
- @Override
- public ResponseEntity<String> getRicsSupportingType(String typeName) {
- try {
- String url = "/a1-policy/v2/rics?policytype_id=" + typeName;
- ResponseEntity<String> rsp = webClient.getForEntity(url).block();
- if (!rsp.getStatusCode().is2xxSuccessful()) {
- return rsp;
- }
-
- JsonArray rics = JsonParser.parseString(rsp.getBody()).getAsJsonObject() //
- .get("rics") //
- .getAsJsonArray(); //
-
- Type listType = new TypeToken<List<ImmutableRicInfo>>() {}.getType();
- List<RicInfo> rspParsed = gson.fromJson(rics, listType);
- Collection<String> result = new ArrayList<>(rspParsed.size());
- for (RicInfo ric : rspParsed) {
- result.add(ric.ric_id());
- }
- String json = gson.toJson(result);
- return new ResponseEntity<>(json, HttpStatus.OK);
- } catch (Exception e) {
- return ErrorResponseHandler.handleException(e);
- }
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.util;
-
-import io.netty.channel.ChannelOption;
-import io.netty.handler.ssl.SslContext;
-import io.netty.handler.ssl.SslContextBuilder;
-import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
-import io.netty.handler.timeout.ReadTimeoutHandler;
-import io.netty.handler.timeout.WriteTimeoutHandler;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-
-import org.immutables.value.Value;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.reactive.ReactorClientHttpConnector;
-import org.springframework.util.ResourceUtils;
-import org.springframework.web.reactive.function.client.ExchangeStrategies;
-import org.springframework.web.reactive.function.client.WebClient;
-import org.springframework.web.reactive.function.client.WebClient.RequestHeadersSpec;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-
-import reactor.core.publisher.Mono;
-import reactor.netty.http.client.HttpClient;
-import reactor.netty.resources.ConnectionProvider;
-import reactor.netty.tcp.TcpClient;
-
-/**
- * Generic reactive REST client.
- */
-public class AsyncRestClient {
-
- @Value.Immutable
- @Value.Style(redactedMask = "####")
- public interface WebClientConfig {
- public boolean isTrustStoreUsed();
-
- @Value.Redacted
- public String trustStorePassword();
-
- public String trustStore();
- }
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private WebClient webClient = null;
- private final String baseUrl;
- private static final AtomicInteger sequenceNumber = new AtomicInteger();
- private final WebClientConfig clientConfig;
- static KeyStore clientTrustStore = null;
-
- public AsyncRestClient(String baseUrl) {
- this(baseUrl,
- ImmutableWebClientConfig.builder().isTrustStoreUsed(false).trustStore("").trustStorePassword("").build());
- }
-
- public AsyncRestClient(String baseUrl, WebClientConfig config) {
- this.baseUrl = baseUrl;
- this.clientConfig = config;
- }
-
- public Mono<ResponseEntity<String>> putForEntity(String uri, String body) {
- Object traceTag = createTraceTag();
- logger.debug("{} PUT uri = '{}{}''", traceTag, baseUrl, uri);
- logger.trace("{} PUT body: {}", traceTag, body);
- return getWebClient() //
- .flatMap(client -> {
- RequestHeadersSpec<?> request = client.put() //
- .uri(uri) //
- .contentType(MediaType.APPLICATION_JSON) //
- .bodyValue(body);
- return retrieve(traceTag, request);
- });
- }
-
- public Mono<ResponseEntity<String>> putForEntity(String uri) {
- Object traceTag = createTraceTag();
- logger.debug("{} PUT uri = '{}{}''", traceTag, baseUrl, uri);
- logger.trace("{} PUT body: <empty>", traceTag);
- return getWebClient() //
- .flatMap(client -> {
- RequestHeadersSpec<?> request = client.put() //
- .uri(uri);
- return retrieve(traceTag, request);
- });
- }
-
- public Mono<String> put(String uri, String body) {
- return putForEntity(uri, body) //
- .flatMap(this::toBody);
- }
-
- public Mono<ResponseEntity<String>> getForEntity(String uri) {
- Object traceTag = createTraceTag();
- logger.debug("{} GET uri = '{}{}''", traceTag, baseUrl, uri);
- return getWebClient() //
- .flatMap(client -> {
- RequestHeadersSpec<?> request = client.get().uri(uri);
- return retrieve(traceTag, request);
- });
- }
-
- public Mono<String> get(String uri) {
- return getForEntity(uri) //
- .flatMap(this::toBody);
- }
-
- public Mono<ResponseEntity<String>> deleteForEntity(String uri) {
- Object traceTag = createTraceTag();
- logger.debug("{} DELETE uri = '{}{}''", traceTag, baseUrl, uri);
- return getWebClient() //
- .flatMap(client -> {
- RequestHeadersSpec<?> request = client.delete().uri(uri);
- return retrieve(traceTag, request);
- });
- }
-
- public Mono<String> delete(String uri) {
- return deleteForEntity(uri) //
- .flatMap(this::toBody);
- }
-
- private Mono<ResponseEntity<String>> retrieve(Object traceTag, RequestHeadersSpec<?> request) {
- final Class<String> clazz = String.class;
- return request.retrieve() //
- .toEntity(clazz) //
- .doOnNext(entity -> logger.trace("{} Received: {}", traceTag, entity.getBody())) //
- .doOnError(throwable -> onHttpError(traceTag, throwable));
- }
-
- private static Object createTraceTag() {
- return sequenceNumber.incrementAndGet();
- }
-
- private void onHttpError(Object traceTag, Throwable t) {
- if (t instanceof WebClientResponseException) {
- WebClientResponseException exception = (WebClientResponseException) t;
- logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
- exception.getResponseBodyAsString());
- } else {
- logger.debug("{} HTTP error: {}", traceTag, t.getMessage());
- }
- }
-
- private Mono<String> toBody(ResponseEntity<String> entity) {
- if (entity.getBody() == null) {
- return Mono.just("");
- } else {
- return Mono.just(entity.getBody());
- }
- }
-
- private boolean isCertificateEntry(KeyStore trustStore, String alias) {
- try {
- return trustStore.isCertificateEntry(alias);
- } catch (KeyStoreException e) {
- logger.error("Error reading truststore {}", e.getMessage());
- return false;
- }
- }
-
- private Certificate getCertificate(KeyStore trustStore, String alias) {
- try {
- return trustStore.getCertificate(alias);
- } catch (KeyStoreException e) {
- logger.error("Error reading truststore {}", e.getMessage());
- return null;
- }
- }
-
- private static synchronized KeyStore getTrustStore(String trustStorePath, String trustStorePass)
- throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
- if (clientTrustStore == null) {
- KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType());
- store.load(new FileInputStream(ResourceUtils.getFile(trustStorePath)), trustStorePass.toCharArray());
- clientTrustStore = store;
- }
- return clientTrustStore;
- }
-
- private SslContext createSslContextRejectingUntrustedPeers(String trustStorePath, String trustStorePass)
- throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
-
- final KeyStore trustStore = getTrustStore(trustStorePath, trustStorePass);
- List<Certificate> certificateList = Collections.list(trustStore.aliases()).stream() //
- .filter(alias -> isCertificateEntry(trustStore, alias)) //
- .map(alias -> getCertificate(trustStore, alias)) //
- .collect(Collectors.toList());
- final X509Certificate[] certificates = certificateList.toArray(new X509Certificate[certificateList.size()]);
-
- return SslContextBuilder.forClient() //
- .trustManager(certificates) //
- .build();
- }
-
- private SslContext createSslContext()
- throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
- if (this.clientConfig.isTrustStoreUsed()) {
- return createSslContextRejectingUntrustedPeers(this.clientConfig.trustStore(),
- this.clientConfig.trustStorePassword());
- } else {
- // Trust anyone
- return SslContextBuilder.forClient() //
- .trustManager(InsecureTrustManagerFactory.INSTANCE) //
- .build();
- }
- }
-
- private WebClient createWebClient(String baseUrl, SslContext sslContext) {
- ConnectionProvider connectionProvider = ConnectionProvider.newConnection();
- TcpClient tcpClient = TcpClient.create(connectionProvider) //
- .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
- .secure(c -> c.sslContext(sslContext)) //
-
- .doOnConnected(connection -> {
- connection.addHandlerLast(new ReadTimeoutHandler(30));
- connection.addHandlerLast(new WriteTimeoutHandler(30));
- });
- HttpClient httpClient = HttpClient.from(tcpClient);
- ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
-
- ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder() //
- .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)) //
- .build();
-
- return WebClient.builder() //
- .clientConnector(connector) //
- .baseUrl(baseUrl) //
- .exchangeStrategies(exchangeStrategies) //
- .build();
- }
-
- private Mono<WebClient> getWebClient() {
- if (this.webClient == null) {
- try {
- SslContext sslContext = createSslContext();
- this.webClient = createWebClient(this.baseUrl, sslContext);
- } catch (Exception e) {
- logger.error("Could not create WebClient {}", e.getMessage());
- return Mono.error(e);
- }
- }
- return Mono.just(this.webClient);
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.util;
-
-import javax.net.ssl.SSLException;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.HttpServerErrorException;
-
-public class ErrorResponseHandler {
-
- private ErrorResponseHandler() {
- throw new IllegalStateException("ErrorResponseHandler is a utility class and not meant to be instantiated");
- }
-
- public static ResponseEntity<String> handleException(Exception throwable) {
- if (throwable instanceof HttpClientErrorException) {
- HttpClientErrorException e = (HttpClientErrorException) throwable;
- return new ResponseEntity<>(e.getMessage(), e.getStatusCode());
- } else if (throwable instanceof HttpServerErrorException) {
- HttpServerErrorException e = (HttpServerErrorException) throwable;
- return new ResponseEntity<>(e.getResponseBodyAsString(), e.getStatusCode());
- } else if (throwable instanceof SSLException) {
- SSLException e = (SSLException) throwable;
- return new ResponseEntity<>("Could not create WebClient " + e.getMessage(),
- HttpStatus.INTERNAL_SERVER_ERROR);
- }
- return new ResponseEntity<>(throwable.getClass().getName() + ": " + throwable.getMessage(),
- HttpStatus.INTERNAL_SERVER_ERROR);
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.util;
-
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-
-import org.apache.axis2.java.security.TrustAllTrustManager;
-
-/**
- * Disables and enables certificate and host-name checking in
- * HttpsURLConnection, the default JVM implementation of the HTTPS/TLS protocol.
- * Has no effect on implementations such as Apache Http Client, Ok Http.
- *
- * https://stackoverflow.com/questions/23504819/how-to-disable-ssl-certificate-checking-with-spring-resttemplate/58291331#58291331
- */
-public final class HttpsURLConnectionUtils {
-
- private static final HostnameVerifier jvmHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
-
- private static final HostnameVerifier trivialHostnameVerifier =
- (hostname, sslSession) -> hostname.equalsIgnoreCase(sslSession.getPeerHost());
-
- private static final TrustManager[] UNQUESTIONING_TRUST_MANAGER = new TrustManager[] {new TrustAllTrustManager()};
-
- public static void turnOffSslChecking() throws NoSuchAlgorithmException, KeyManagementException {
- HttpsURLConnection.setDefaultHostnameVerifier(trivialHostnameVerifier);
- // Install the all-trusting trust manager
- SSLContext sc = SSLContext.getInstance("TLS");
- sc.init(null, UNQUESTIONING_TRUST_MANAGER, null);
- HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- }
-
- public static void turnOnSslChecking() throws KeyManagementException, NoSuchAlgorithmException {
- HttpsURLConnection.setDefaultHostnameVerifier(jvmHostnameVerifier);
- // Return it to the initial state (discovered by reflection, now hardcoded)
- SSLContext sc = SSLContext.getInstance("TLS");
- sc.init(null, null, null);
- HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- }
-
- private HttpsURLConnectionUtils() {
- throw new UnsupportedOperationException("Do not instantiate libraries.");
- }
-}
+++ /dev/null
-package org.oransc.portal.nonrtric.controlpanel.util;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class JsonArrayHandler {
-
- public static com.google.gson.Gson gson = new GsonBuilder().create();
-
- public static <T> List<T> parseJsonArray(String jsonString, Class<T> clazz) {
- List<T> result = new ArrayList<>();
- JsonArray jsonArr = JsonParser.parseString(jsonString).getAsJsonArray();
- for (JsonElement jsonElement : jsonArr) {
- T json = gson.fromJson(jsonElement.toString(), clazz);
- result.add(json);
- }
- return result;
- }
-}
+++ /dev/null
-# ========================LICENSE_START=================================
-# O-RAN-SC
-# %%
-# Copyright (C) 2019 AT&T Intellectual Property
-# Modifications Copyright (C) 2019 Nordix Foundation
-# %%
-# 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===================================
-
-# Defines Non-RT RIC Control Panel property keys and default values.
-# Create a copy in the launch directory to override values; or
-# copy to "application-abc.properties" as mentioned in the README.
-
-# A spring property but without a "spring" prefix;
-# the port number is chosen RANDOMLY when running tests
-server.port = 8082
-server.ssl.key-store-type = PKCS12
-server.ssl.key-store-password = ericsson_kwdjfhw
-server.ssl.key-store = classpath:keystore.jks
-server.ssl.key-password = ericsson_kwdjfhw
-server.http.port = 8080
-
-# endpoint URLs must be supplied at deployment time
-# NOTE: change policycontroller.url.prefix to http://localhost:8081 when running
-# controlpanel locally (i.e., not inside the docker container)
-# policycontroller.url.prefix = https://policy-agent-container:8433
-policycontroller.url.prefix = http://policy-agent-container:8081
-
-# URL for enrichment coordinator service
-# enrichmentcontroller.url.prefix = https://enrichment-service-container:8434
-enrichmentcontroller.url.prefix = http://enrichment-service-container:8083/ei-producer/v1
-
-# Mimic slow endpoints by defining sleep period, in milliseconds
-mock.config.delay = 0
+++ /dev/null
-# ========================LICENSE_START=================================
-# O-RAN-SC
-# %%
-# Copyright (C) 2019 AT&T Intellectual Property
-# %%
-# 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===================================
-
-# Test properties for the EPSDK-FW library.
-# This file must be present on the Java classpath.
-
-cipher.enc.key = bogus
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ========================LICENSE_START=================================
- O-RAN-SC
- %%
- Copyright (C) 2019 AT&T Intellectual Property
- Modifications Copyright (C) 2020 Nordix Foundation
- %%
- 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===================================
- -->
-
-<configuration>
-
- <!-- Basic logback configuration for dev and test -->
-
- <!-- component name is log file basename -->
- <property name="componentName" value="nonrtric-controlpanel"></property>
- <!-- gather files in a subdirectory -->
- <property name="logDirectory" value="logs" />
- <!-- output pattern -->
- <property name="pattern" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} - %msg%n"/>
-
- <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
- <!-- defaults to type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
- <encoder>
- <pattern>${pattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${componentName}.log</file>
- <append>true</append>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/${componentName}.%i.log.zip</fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>10MB</maxFileSize>
- </triggeringPolicy>
- <!-- defaults to type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
- <encoder>
- <pattern>${pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Set default level for all loggers -->
- <root level="INFO">
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="FILE" />
- </root>
-
- <!-- Code under test should be chatty --> >
- <logger name="org.oransc.portal.nonrtric.controlpanel" level="DEBUG" />
-
- <!-- Watch authentication done by EPSDK-FW -->
- <logger name="org.onap.portalsdk.core.onboarding.crossapi" level="DEBUG" />
-
- <!-- Report request URLs -->
- <logger name="org.springframework.web.client.RestTemplate" level="DEBUG" />
-
- <!-- for debugging security
- <logger name="org.springframework.security" level="DEBUG" />
- -->
-
-</configuration>
+++ /dev/null
-<!DOCTYPE html>
-<!--
- ========================LICENSE_START=================================
- O-RAN-SC
- %%
- Copyright (C) 2019 AT&T Intellectual Property
- %%
- 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===================================
- -->
-
-<html>
-<head>
-<title>Static error page</title>
-<style>
-html, body {
- font-family: Helvetica, Arial, sans-serif;
-}
-</style>
-</head>
-<body>
-<h2>Non-RT RIC Control Panel Error</h2>
-<h4>The previous request could not be processed.</h4>
-<a href="/">Click here to reload the application</a>
-</body>
-</html>
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel;
-
-import java.lang.invoke.MethodHandles;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-/**
- * This class supports front-end web development. Placing this class in the test
- * area allows excluding the mock configuration classes and the Mockito
- * dependencies from the packaged version of the app.
- *
- * To launch a development server set the environment variable as listed below.
- * This runs a Spring-Boot server with mock back-end beans, and keeps the server
- * alive for manual testing. Supply this JVM argument:
- */
-@SuppressWarnings("java:S3577") // Class name should start or end with Test. This is not a test class per se, but a mock
- // of the server.
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
-class MockControlPanelBackEnd {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @LocalServerPort
- private int port;
-
- /*
- * Keeps the test server alive forever. Use a guard so this test is never run by
- * Jenkins.
- */
- @SuppressWarnings("squid:S2699") // To avoid warning about missing assertion.
- @Test
- void keepServerAlive() {
- logger.warn("Keeping server alive! Port: " + this.port);
- try {
- synchronized (this) {
- this.wait();
- }
- } catch (Exception ex) {
- logger.warn(ex.toString());
- }
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.lang.invoke.MethodHandles;
-import java.util.stream.Collectors;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerInfo;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.context.ApplicationContext;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-class RestApiTest {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
- @Autowired
- ApplicationContext context;
-
- @LocalServerPort
- private int port;
-
- @Test
- void createApiDoc() throws FileNotFoundException {
- String url = "/v2/api-docs";
- ResponseEntity<String> resp = restClient().getForEntity(url).block();
- assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
- JsonObject jsonElement = JsonParser.parseString(resp.getBody()).getAsJsonObject();
- jsonElement.remove("host");
- String indented = gson.toJson(jsonElement);
- try (PrintStream out = new PrintStream(new FileOutputStream("../docs/api.json"))) {
- out.println(indented);
- }
- }
-
- @Test
- void getJobs() throws FileNotFoundException {
- String url = "/api/enrichment/eijobs";
- ResponseEntity<String> resp = restClient().getForEntity(url).block();
- assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
-
- JsonArray jobs = JsonParser.parseString(resp.getBody()).getAsJsonArray();
- JobInfo wantedJobInfo = JobInfo.builder() //
- .id("job1") //
- .typeId("type1") //
- .jobData(getStringFromFile("job-1.json")) //
- .targetUri("http://example.com/") //
- .owner("owner") //
- .build();
- JobInfo wantedJobInfo2 = JobInfo.builder() //
- .id("job2") //
- .typeId("type2") //
- .jobData(getStringFromFile("job-2.json")) //
- .targetUri("http://example.com/") //
- .owner("owner") //
- .build();
- assertThat(jobs).hasSize(6) //
- .contains(gson.toJsonTree(wantedJobInfo), //
- gson.toJsonTree(wantedJobInfo2));
- }
-
- @Test
- void getProducers() {
- String url = "/api/enrichment/eiproducers";
- ResponseEntity<String> resp = restClient().getForEntity(url).block();
- assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
-
- JsonArray producers = JsonParser.parseString(resp.getBody()).getAsJsonArray();
-
- ProducerInfo wantedProducerInfo = ProducerInfo.builder() //
- .id("prod-1") //
- .types(new String[] {"type1", "type2"}) //
- .status("ENABLED") //
- .build();
- ProducerInfo wantedProducerInfo2 = ProducerInfo.builder() //
- .id("prod-2") //
- .types(new String[] {"type1"}) //
- .status("DISABLED") //
- .build();
- ProducerInfo wantedProducerInfo3 = ProducerInfo.builder() //
- .id("3-prod") //
- .types(new String[] {"type1", "type2"}) //
- .status("ENABLED") //
- .build();
- assertThat(producers).hasSize(3) //
- .contains(gson.toJsonTree(wantedProducerInfo), //
- gson.toJsonTree(wantedProducerInfo2), //
- gson.toJsonTree(wantedProducerInfo3));
- }
-
- private AsyncRestClient restClient() {
- return new AsyncRestClient(baseUrl());
- }
-
- private String baseUrl() {
- return "https://localhost:" + this.port;
- }
-
- private String getStringFromFile(String path) {
- try {
- InputStream inputStream = MethodHandles.lookup().lookupClass().getClassLoader().getResourceAsStream(path);
- return new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
- } catch (Exception e) {
- logger.error("Cannot read file :" + path, e);
- return "";
- }
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import java.lang.invoke.MethodHandles;
-import java.net.URI;
-import java.util.Map;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.springframework.web.util.UriComponentsBuilder;
-
-@ExtendWith(SpringExtension.class)
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-// Need the fake answers from the backend
-class AbstractControllerTest {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- // Created by Spring black magic
- // https://spring.io/guides/gs/testing-web/
- @LocalServerPort
- private int localServerPort;
-
- protected final AsyncRestClient webClient = new AsyncRestClient("");
-
- /**
- * Flexible URI builder.
- *
- * @param queryParams Map of string-string query parameters
- * @param path Array of path components. If a component has an embedded
- * slash, the string is split and each subcomponent is added
- * individually.
- * @return URI
- */
- protected URI buildUri(final Map<String, String> queryParams, final String... path) {
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("https://localhost:" + localServerPort + "/");
- for (int p = 0; p < path.length; ++p) {
- if (path[p] == null || path[p].isEmpty()) {
- throw new IllegalArgumentException("Unexpected null or empty at path index " + Integer.toString(p));
- } else if (path[p].contains("/")) {
- String[] subpaths = path[p].split("/");
- for (String s : subpaths)
- if (!s.isEmpty())
- builder.pathSegment(s);
- } else {
- builder.pathSegment(path[p]);
- }
- }
- if (queryParams != null && queryParams.size() > 0) {
- for (Map.Entry<String, String> entry : queryParams.entrySet()) {
- if (entry.getKey() == null || entry.getValue() == null)
- throw new IllegalArgumentException("Unexpected null key or value");
- else
- builder.queryParam(entry.getKey(), entry.getValue());
- }
- }
- return builder.build().encode().toUri();
- }
-
- // Because I put the annotations on this parent class,
- // must define at least one test here.
- @Test
- void contextLoads() {
- // Silence Sonar warning about missing assertion.
- Assertions.assertTrue(logger.isWarnEnabled());
- logger.info("Context loads on mock profile");
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 AT&T Intellectual Property
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.controller;
-
-import java.lang.invoke.MethodHandles;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-/**
- * Tests whether the default (not mock) configuration classes run to completion.
- */
-@ExtendWith(SpringExtension.class)
-@SpringBootTest
-class DefaultContextTest {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @Test
- void contextLoads() {
- // Silence Sonar warning about missing assertion.
- Assertions.assertTrue(logger.isWarnEnabled());
- logger.info("Context loads on default profile");
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.eiproducerapi;
-
-import static org.junit.Assert.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonSyntaxException;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.jupiter.api.Test;
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerStatusInfo;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.HttpServerErrorException;
-import reactor.core.publisher.Mono;
-
-class EiProducerApiImplTest {
- private static final String URL_EI_PRODUCERS = "/eiproducers";
- private static final String EI_PRODUCER_1 = "eiprod1";
- private static final String EI_PRODUCER_2 = "eiprod2";
- private static final String EI_PRODUCER_1_INFO_VALID =
- "{\"supported_ei_types\":[{\"ei_type_identity\":\"eitype1\",\"ei_job_data_schema\":{\"title\":\"eijob1\"}}]}";
- private static final String EI_PRODUCER_1_INFO_INVALID =
- "{\"supported_ei_types\":[{\"ei_type_identity\":\"eitype1\",\"ei_job_data_schema\":\"title\":\"eijob1\"}}]}";
- private static final String URL_STATUS = "/status";
- private static final String EI_PRODUCER_1_STATUS_VALID = "{\"operational_state\":\"ENABLED\"}";
- private static final String EI_PRODUCER_1_STATUS_INVALID = "\"operational_state\":\"ENABLED\"}";
- private static final String URL_EI_JOBS = "/eijobs";
- private static final String EI_JOB_1_INFO =
- "{\"ei_job_identity\":\"eijob1\",\"ei_job_data\":{},\"ei_type_identity\":\"eitype1\"}";
- private static final String EI_JOB_2_INFO =
- "{\"ei_job_identity\":\"eijob2\",\"ei_job_data\":{},\"ei_type_identity\":\"eitype2\"}";
-
- AsyncRestClient restClientMock = mock(AsyncRestClient.class);
- EiProducerApiImpl apiUnderTest = new EiProducerApiImpl(restClientMock);
- private static com.google.gson.Gson gson = new GsonBuilder().create();
-
- private void whenGetReturnOK(String url, HttpStatus status, String body) {
- ResponseEntity<String> ret = new ResponseEntity<>(body, status);
- when(restClientMock.getForEntity(eq(url))).thenReturn(Mono.just(ret));
- }
-
- private void whenGetReturnFailure(String url, HttpStatus status, String body) {
- HttpServerErrorException e = new HttpServerErrorException(status, body);
- when(restClientMock.getForEntity(eq(url))).thenReturn(Mono.error(e));
- }
-
- @Test
- void testGetAllEiProducerIdsFailure() {
- whenGetReturnFailure(URL_EI_PRODUCERS, HttpStatus.NOT_FOUND, "");
- ResponseEntity<String> returnedResp = apiUnderTest.getAllEiProducerIds();
- assertEquals(HttpStatus.NOT_FOUND, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetAllEiProducerIdsSuccess() {
- String eiProducerIds = Arrays.asList(EI_PRODUCER_1, EI_PRODUCER_2).toString();
-
- whenGetReturnOK(URL_EI_PRODUCERS, HttpStatus.OK, eiProducerIds);
-
- ResponseEntity<String> returnedResp = apiUnderTest.getAllEiProducerIds();
- assertEquals("[\"" + EI_PRODUCER_1 + "\",\"" + EI_PRODUCER_2 + "\"]", returnedResp.getBody());
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetEiProducerValidJson() {
- whenGetReturnOK(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1, HttpStatus.OK, EI_PRODUCER_1_INFO_VALID);
-
- ResponseEntity<ProducerRegistrationInfo> returnedResp = apiUnderTest.getEiProducer(EI_PRODUCER_1);
-
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- assertEquals(EI_PRODUCER_1_INFO_VALID, gson.toJson(returnedResp.getBody()));
- }
-
- @Test
- public void whenGetEiProducerExceptionThrown_thenAssertionSucceeds() {
- whenGetReturnOK(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1, HttpStatus.OK, EI_PRODUCER_1_INFO_INVALID);
- Exception exception = assertThrows(JsonSyntaxException.class, () -> {
- apiUnderTest.getEiProducer(EI_PRODUCER_1);
- });
-
- String expectedMessage = "Expected BEGIN_OBJECT but was STRING";
- String actualMessage = exception.getMessage();
- assertTrue(actualMessage.contains(expectedMessage));
- }
-
- @Test
- void whenGetEiJobsForOneEiProducerExceptionThrown_thenAssertionSucceeds() {
- whenGetReturnFailure(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1 + URL_EI_JOBS, HttpStatus.NOT_FOUND, "");
- Exception exception = assertThrows(IllegalStateException.class, () -> {
- apiUnderTest.getEiJobsForOneEiProducer(EI_PRODUCER_1);
- });
-
- String expectedMessage = "Not a JSON Array: null";
- String actualMessage = exception.getMessage();
- assertTrue(actualMessage.contains(expectedMessage));
- }
-
- @Test
- void testGetEiJobsForOneEiProducerSuccess() {
- String eiJobs = Arrays.asList(EI_JOB_1_INFO, EI_JOB_2_INFO).toString();
-
- whenGetReturnOK(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1 + URL_EI_JOBS, HttpStatus.OK, eiJobs);
-
- ResponseEntity<List<JobInfo>> returnedResp = apiUnderTest.getEiJobsForOneEiProducer(EI_PRODUCER_1);
- assertTrue(gson.toJson(returnedResp.getBody()).contains("\"ei_job_identity\":\"eijob1\""));
- assertTrue(gson.toJson(returnedResp.getBody()).contains("\"ei_job_identity\":\"eijob2\""));
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetEiProducerStatusValidJson() {
- whenGetReturnOK(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1 + URL_STATUS, HttpStatus.OK, EI_PRODUCER_1_STATUS_VALID);
-
- ResponseEntity<ProducerStatusInfo> returnedResp = apiUnderTest.getEiProducerStatus(EI_PRODUCER_1);
-
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- assertEquals(EI_PRODUCER_1_STATUS_VALID, gson.toJson(returnedResp.getBody()));
- }
-
- @Test
- public void whenGetEiProducerStatusExceptionThrown_thenAssertionSucceeds() {
- whenGetReturnOK(URL_EI_PRODUCERS + "/" + EI_PRODUCER_1 + URL_STATUS, HttpStatus.OK,
- EI_PRODUCER_1_STATUS_INVALID);
- Exception exception = assertThrows(JsonSyntaxException.class, () -> {
- apiUnderTest.getEiProducerStatus(EI_PRODUCER_1);
- });
-
- String expectedMessage = "Expected BEGIN_OBJECT but was STRING";
- String actualMessage = exception.getMessage();
- assertTrue(actualMessage.contains(expectedMessage));
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.mock;
-
-import com.google.gson.GsonBuilder;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.oransc.portal.nonrtric.controlpanel.eiproducerapi.EiProducerApi;
-import org.oransc.portal.nonrtric.controlpanel.model.JobInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerRegistrationInfo.ProducerEiTypeRegistrationInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.ProducerStatusInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestClientException;
-
-/**
- * Creates a mock implementation of the policy controller client API.
- */
-@TestConfiguration
-public class EnrichmentControllerMockConfiguration {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private static com.google.gson.Gson gson = new GsonBuilder() //
- .serializeNulls() //
- .create(); //
-
- @Bean
- public EiProducerApi eiProducerApi() {
- MockEiProducerApi apiClient = new MockEiProducerApi();
- return apiClient;
- }
-
- class MockEiProducerApi implements EiProducerApi {
- private final Database database = new Database();
-
- @Override
- public ResponseEntity<String> getAllEiProducerIds() {
- List<String> result = new ArrayList<>();
- result.addAll(database.getAllEiProducerIds());
- return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
- }
-
- public ResponseEntity<String> getAllEiProducers() {
- List<ProducerRegistrationInfo> result = new ArrayList<>();
- result.addAll(database.getAllEiProducers());
- return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<ProducerRegistrationInfo> getEiProducer(String eiProducerId) {
- ProducerRegistrationInfo result = database.getEiProducerInstance(eiProducerId);
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<List<JobInfo>> getEiJobsForOneEiProducer(String eiProducerId) {
- List<JobInfo> result = new ArrayList<>();
-
- result.addAll(database.getAllEiJobs());
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<ProducerStatusInfo> getEiProducerStatus(String eiProducerId) {
- ProducerRegistrationInfo result = database.getEiProducerInstance(eiProducerId);
- return new ResponseEntity<>(result.status, HttpStatus.OK);
- }
- }
-
- class Database {
-
- Database() {
-
- List<ProducerEiTypeRegistrationInfo> supported_types = new ArrayList<ProducerEiTypeRegistrationInfo>();
-
- // Create ProducerEiTypeRegistrationInfo instance
- String schema = getStringFromFile("ei-type-1.json");
- ProducerEiTypeRegistrationInfo eiType1 = getEiTypeInstance("type1", schema, Arrays.asList("prod-1"));
- supported_types.add(eiType1);
-
- // Create ProducerEiTypeRegistrationInfo instance
- schema = getStringFromFile("ei-type-2.json");
- ProducerEiTypeRegistrationInfo eiType2 = getEiTypeInstance("type2", schema, Arrays.asList("prod-1"));
- supported_types.add(eiType2);
-
- // Create ProducerRegistrationInfo instance
- putEiProducerInstance("prod-1", "http://example.com/", "http://example.com/", "http://example.com/",
- supported_types, new ProducerStatusInfo(ProducerStatusInfo.OperationalState.ENABLED));
-
- putEiProducerInstance("prod-2", "http://example.com/", "http://example.com/", "http://example.com/",
- Arrays.asList(supported_types.get(0)), new ProducerStatusInfo(ProducerStatusInfo.OperationalState.DISABLED));
-
- putEiProducerInstance("3-prod", "http://example.com/", "http://example.com/", "http://example.com/",
- supported_types, new ProducerStatusInfo(ProducerStatusInfo.OperationalState.ENABLED));
-
- // Create EiJob instance
- schema = getStringFromFile("job-1.json");
- putEiJobInstance("type1", "job1", schema, "owner", "http://example.com/");
-
- schema = getStringFromFile("job-1.json");
- putEiJobInstance("type2", "job2", schema, "owner", "http://example.com/");
- }
-
- private String getStringFromFile(String path) {
- try {
- InputStream inputStream =
- MethodHandles.lookup().lookupClass().getClassLoader().getResourceAsStream(path);
- return new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
- } catch (Exception e) {
- logger.error("Cannot read file :" + path, e);
- return "";
- }
- }
-
- String normalize(String str) {
- return str.replace('\n', ' ');
- }
-
- void putEiJobInstance(String typeId, String instanceId, Object instanceData, String owner, String targetUrl) {
- JobInfo i = JobInfo.builder() //
- .jobData(instanceData) //
- .id(instanceId) //
- .owner(owner) //
- .typeId(typeId) //
- .targetUri(targetUrl) //
- .build(); //
- eiJobs.put(instanceId, i);
- }
-
- void putEiProducerInstance(String id, String creation_url, String deletion_url, String callback_url,
- List<ProducerEiTypeRegistrationInfo> supported_types, ProducerStatusInfo status) {
- ProducerRegistrationInfo eiProducer = ProducerRegistrationInfo.builder() //
- .jobCallbackUrl(creation_url) //
- .producerSupervisionCallbackUrl(callback_url) //
- .types(supported_types) //
- .status(status) //
- .build(); //
- eiProducers.put(id, eiProducer);
- }
-
- ProducerEiTypeRegistrationInfo getEiTypeInstance(String id, Object data, List<String> producer_ids) {
- return ProducerEiTypeRegistrationInfo.builder() //
- .eiTypeId(id) //
- .jobDataSchema(data) //
- .build(); //
- }
-
- public void deleteEiProducerInstance(String id) {
- eiProducers.remove(id);
- }
-
- public void deleteEiJobInstance(String id) {
- eiJobs.remove(id);
- }
-
- ProducerRegistrationInfo getEiProducerInstance(String id) throws RestClientException {
- ProducerRegistrationInfo i = eiProducers.get(id);
- if (i == null) {
- throw new RestClientException("Producer not found: " + id);
- }
- return i;
- }
-
- public Collection<String> getAllEiProducerIds() {
- return Collections.unmodifiableCollection(eiProducers.keySet());
- }
-
- public Collection<ProducerRegistrationInfo> getAllEiProducers() {
- return eiProducers.values();
- }
-
- public List<JobInfo> getAllEiJobs() {
- return new ArrayList<>(eiJobs.values());
- }
-
- private Map<String, ProducerRegistrationInfo> eiProducers = new HashMap<>();
- private Map<String, JobInfo> eiJobs = new HashMap<>();
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2019 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.mock;
-
-import com.google.gson.GsonBuilder;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Vector;
-import java.util.stream.Collectors;
-
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInstances;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyType;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyTypes;
-import org.oransc.portal.nonrtric.controlpanel.policyagentapi.PolicyAgentApi;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestClientException;
-
-/**
- * Creates a mock implementation of the policy controller client API.
- */
-@TestConfiguration
-public class PolicyControllerMockConfiguration {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private static com.google.gson.Gson gson = new GsonBuilder() //
- .serializeNulls() //
- .create(); //
-
- @Bean
- public PolicyAgentApi policyAgentApi() {
- MockPolicyAgentApi apiClient = new MockPolicyAgentApi();
- return apiClient;
- }
-
- class MockPolicyAgentApi implements PolicyAgentApi {
- private final Database database = new Database();
-
- @Override
- public ResponseEntity<Object> getPolicyInstance(String id) {
- return new ResponseEntity<>(database.getInstance(id), HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<String> putPolicy(String policyTypeIdString, String policyInstanceId, Object json,
- String ric) {
- database.putInstance(policyTypeIdString, policyInstanceId, json, ric);
- return new ResponseEntity<>(HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<String> deletePolicy(String policyInstanceId) {
- database.deleteInstance(policyInstanceId);
- return new ResponseEntity<>(HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<String> getAllPolicyTypes() {
- PolicyTypes result = new PolicyTypes();
- result.addAll(database.getTypes());
- return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<String> getPolicyInstancesForType(String type) {
- PolicyInstances result = new PolicyInstances();
- List<PolicyInfo> inst = database.getInstances(Optional.of(type));
- result.addAll(inst);
- return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
- }
-
- @Override
- public ResponseEntity<String> getRicsSupportingType(String typeName) {
- Vector<String> res = new Vector<>();
- res.add("ric_1");
- res.add("ric_2");
- res.add("ric_3");
- return new ResponseEntity<>(gson.toJson(res), HttpStatus.OK);
- }
- }
-
- class Database {
-
- Database() {
- PolicyType policyType = new PolicyType("", "{}");
- types.put("", policyType);
-
- String schema = getStringFromFile("demo-policy-schema-1.json");
- policyType = new PolicyType("type2", schema);
- types.put("type2", policyType);
-
- schema = getStringFromFile("demo-policy-schema-2.json");
- policyType = new PolicyType("type3", schema);
- types.put("type3", policyType);
-
- schema = getStringFromFile("demo-policy-schema-3.json");
- policyType = new PolicyType("type4", schema);
- types.put("type4", policyType);
-
- putInstance("", "123", "{\"data\":\"data\"}", "ric_1");
- }
-
- private String getStringFromFile(String path) {
- try {
- InputStream inputStream =
- MethodHandles.lookup().lookupClass().getClassLoader().getResourceAsStream(path);
- return new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
- } catch (Exception e) {
- logger.error("Cannot read file :" + path, e);
- return "";
- }
- }
-
- String normalize(String str) {
- return str.replace('\n', ' ');
- }
-
- private String getTimeStampUTC() {
- return java.time.Instant.now().toString();
- }
-
- void putInstance(String typeId, String instanceId, Object instanceData, String ric) {
- PolicyInfo i = PolicyInfo.builder() //
- .policyData(instanceData) //
- .lastModified(getTimeStampUTC()) //
- .policyId(instanceId) //
- .ricId(ric) //
- .serviceId("service") //
- .policyTypeId(typeId) //
- .build(); //
- instances.put(instanceId, i);
- }
-
- public void deleteInstance(String instanceId) {
- instances.remove(instanceId);
- }
-
- Object getInstance(String id) throws RestClientException {
- PolicyInfo i = instances.get(id);
- if (i == null) {
- throw new RestClientException("Type not found: " + id);
- }
- return i.policyData;
- }
-
- public Collection<PolicyType> getTypes() {
- return types.values();
- }
-
- public List<PolicyInfo> getInstances(Optional<String> typeId) {
- ArrayList<PolicyInfo> result = new ArrayList<>();
- for (PolicyInfo i : instances.values()) {
- if (typeId.isPresent()) {
- if (i.policyTypeId.equals(typeId.get())) {
- result.add(i);
- }
-
- } else {
- result.add(i);
- }
- }
- return result;
- }
-
- private Map<String, PolicyType> types = new HashMap<>();
- private Map<String, PolicyInfo> instances = new HashMap<>();
-
- }
-
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * Modifications Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.policyagentapi;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInfo;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInstance;
-import org.oransc.portal.nonrtric.controlpanel.model.PolicyInstances;
-import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.HttpServerErrorException;
-import reactor.core.publisher.Mono;
-
-class PolicyAgentApiImplTest {
- private static final String URL_POLICY_SCHEMAS = "/a1-policy/v2/policy-types";
- private static final String POLICY_TYPE_1_ID = "type1";
- private static final String POLICY_TYPE_1_VALID = "{\"title\":\"type1\"}";
- private static final String POLICY_TYPE_1_INVALID = "\"title\":\"type1\"}";
- private static final String POLICY_TYPE_2_VALID = "{\"title\":\"type2\"}";
- private static final String POLICY_1_ID = "policy1";
- private static final String POLICY_DATA =
- "{\"qosObjectives\":{\"priorityLevel\":22.0},\"scope\":{\"qosId\":\"22\",\"ueId\":\"22\"}}";
- private static final String POLICY_1_VALID =
- "{\"policy_id\":\"policy1\",\"policytype_id\":\"type1\",\"ric_id\":\"ric1\",\"policy_data\":" + POLICY_DATA
- + ",\"service_id\":\"controlpanel\"}";
- private static final String POLICY_1_INVALID = "\"policy_id\":\"policy1\"}";
- private static final String RIC_1_ID = "ric1";
- private static final String RIC_1_INFO_VALID = "{\"ric_id\":\"ric1\",\"policytype_ids\":[\"type1\"]}";
- private static final String RIC_1_INFO_INVALID = "{\"ric_id\":\"ric1\",\"policytype_ids\":\"type1\"]}";
- private static final String CLIENT_ERROR_MESSAGE = "XXXXXXX";
- private static final String SERVICE_ID = "controlpanel";
- private static final String TIMESTAMP = "2021-01-12T09:59:33.392470Z";
- private static final String STATUS =
- "{\"last_modified\": \"" + TIMESTAMP + "\",\"status\":{\"enforceStatus\": \"\",\"enforceReason\": \"\"}}";
- private static com.google.gson.Gson gson = new GsonBuilder() //
- .serializeNulls() //
- .create(); //
-
- PolicyAgentApiImpl apiUnderTest;
-
- AsyncRestClient restClient;
-
- @BeforeEach
- void init() {
- restClient = mock(AsyncRestClient.class);
- apiUnderTest = new PolicyAgentApiImpl(restClient);
- }
-
- private void whenGetReturnOK(String url, HttpStatus status, String body) {
- ResponseEntity<String> ret = new ResponseEntity<>(body, status);
- when(restClient.getForEntity(eq(url))).thenReturn(Mono.just(ret));
- }
-
- private void whenGetReturnFailure(String url, HttpStatus status, String body) {
- HttpServerErrorException e = new HttpServerErrorException(status, body);
- when(restClient.getForEntity(eq(url))).thenReturn(Mono.error(e));
- }
-
- @Test
- void testGetAllPolicyTypesFailure() {
- whenGetReturnFailure(URL_POLICY_SCHEMAS, HttpStatus.NOT_FOUND, "");
- ResponseEntity<String> returnedResp = apiUnderTest.getAllPolicyTypes();
- assertEquals(HttpStatus.NOT_FOUND, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetAllPolicyTypesSuccessValidJson() {
- String returnValue = "{\"policytype_ids\": [\"type1\",\"type2\"]}";
- whenGetReturnOK(URL_POLICY_SCHEMAS, HttpStatus.OK, returnValue);
- whenGetReturnOK(URL_POLICY_SCHEMAS + "/type1", HttpStatus.OK, "{\"policy_schema\":{}}");
- whenGetReturnOK(URL_POLICY_SCHEMAS + "/type2", HttpStatus.OK, "{\"policy_schema\":{}}");
-
- ResponseEntity<String> resp = apiUnderTest.getAllPolicyTypes();
- assertTrue(resp.getBody().contains("\"name\":\"type1\""));
- assertEquals(HttpStatus.OK, resp.getStatusCode());
- }
-
- @Test
- void testGetAllPolicyTypesSuccessInvalidJson() {
- String policyTypes = Arrays.asList(POLICY_TYPE_1_INVALID, POLICY_TYPE_2_VALID).toString();
- whenGetReturnOK(URL_POLICY_SCHEMAS, HttpStatus.OK, policyTypes);
-
- ResponseEntity<String> returnedResp = apiUnderTest.getAllPolicyTypes();
-
- assertTrue(returnedResp.getBody().contains("Exception"));
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, returnedResp.getStatusCode());
- }
-
- private String urlPolicyInstances(String type) {
- return "/a1-policy/v2/policies?policytype_id=" + type;
- }
-
- @Test
- void testGetPolicyInstancesForTypeFailure() {
- whenGetReturnFailure(urlPolicyInstances(POLICY_TYPE_1_ID), HttpStatus.NOT_FOUND, "");
-
- ResponseEntity<String> returnedResp = apiUnderTest.getPolicyInstancesForType(POLICY_TYPE_1_ID);
-
- assertEquals(HttpStatus.NOT_FOUND, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetPolicyInstancesForTypeSuccessValidJson() {
- String policyInstances = "{\"policy_ids\":[\"policy1\"]}";
- String policyInstancesJson = parsePolicyInstancesJson("[\"policy1\"]");
-
- whenGetReturnOK(urlPolicyInstances(POLICY_TYPE_1_ID), HttpStatus.OK, policyInstances);
- whenGetReturnOK(urlPolicyInstance(POLICY_1_ID), HttpStatus.OK, POLICY_1_VALID);
- whenGetReturnOK(urlPolicyStatus(POLICY_1_ID), HttpStatus.OK, STATUS);
-
- ResponseEntity<String> returnedResp = apiUnderTest.getPolicyInstancesForType(POLICY_TYPE_1_ID);
- assertEquals(returnedResp.getBody(), policyInstancesJson);
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- }
-
- @Test
- void testGetPolicyInstancesForTypeSuccessInvalidJson() {
- String policyInstances = Arrays.asList(POLICY_1_INVALID).toString();
-
- whenGetReturnOK(urlPolicyInstances(POLICY_TYPE_1_ID), HttpStatus.OK, policyInstances);
-
- ResponseEntity<String> returnedResp = apiUnderTest.getPolicyInstancesForType(POLICY_TYPE_1_ID);
-
- assertTrue(returnedResp.getBody().contains("Exception"));
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, returnedResp.getStatusCode());
- }
-
- private String urlPolicyInstance(String id) {
- return "/a1-policy/v2/policies/" + id;
- }
-
- private String urlPolicyStatus(String id) {
- return "/a1-policy/v2/policies/" + id + "/status";
- }
-
- @Test
- void testGetPolicyInstance() {
- whenGetReturnOK(urlPolicyInstance(POLICY_1_ID), HttpStatus.OK, POLICY_1_VALID);
- whenGetReturnOK(urlPolicyStatus(POLICY_1_ID), HttpStatus.OK, STATUS);
-
- ResponseEntity<Object> returnedResp = apiUnderTest.getPolicyInstance(POLICY_1_ID);
-
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- assertEquals(POLICY_DATA, gson.toJson(returnedResp.getBody()));
- }
-
- private String urlPutPolicy() {
- return "/a1-policy/v2/policies/";
- }
-
- private void whenPutReturnOK(String url, String putBody, HttpStatus status, String body) {
- ResponseEntity<String> ret = new ResponseEntity<>(body, status);
- when(restClient.putForEntity(eq(url), eq(putBody))).thenReturn(Mono.just(ret));
- }
-
- private void whenPutReturnFailure(String url, String putBody, HttpStatus status, String body) {
- HttpServerErrorException e =
- new HttpServerErrorException(status, body, body.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
- when(restClient.putForEntity(eq(url), eq(putBody))).thenReturn(Mono.error(e));
- }
-
- @Test
- void testPutPolicyFailure() {
- String url = urlPutPolicy();
- JsonElement data = JsonParser.parseString(POLICY_DATA).getAsJsonObject();
- PolicyInstance i = PolicyInstance.builder() //
- .policyId(POLICY_1_ID) //
- .policyTypeId(POLICY_TYPE_1_ID) //
- .ricId(RIC_1_ID) //
- .policyData(data) //
- .serviceId(SERVICE_ID) //
- .build(); //
-
- String jsonStr = gson.toJson(i);
- whenPutReturnFailure(url, jsonStr, HttpStatus.NOT_FOUND, CLIENT_ERROR_MESSAGE);
-
- ResponseEntity<String> returnedResp =
- apiUnderTest.putPolicy(POLICY_TYPE_1_ID, POLICY_1_ID, POLICY_DATA, RIC_1_ID);
-
- assertTrue(returnedResp.getBody().contains(CLIENT_ERROR_MESSAGE));
- assertEquals(HttpStatus.NOT_FOUND, returnedResp.getStatusCode());
- }
-
- @Test
- void testPutPolicySuccess() {
- String url = urlPutPolicy();
- JsonElement data = JsonParser.parseString(POLICY_DATA).getAsJsonObject();
- PolicyInstance i = PolicyInstance.builder() //
- .policyId(POLICY_1_ID) //
- .policyTypeId(POLICY_TYPE_1_ID) //
- .ricId(RIC_1_ID) //
- .policyData(data) //
- .serviceId(SERVICE_ID) //
- .build(); //
- String jsonStr = gson.toJson(i);
- whenPutReturnOK(url, jsonStr, HttpStatus.OK, POLICY_1_VALID);
-
- ResponseEntity<String> returnedResp =
- apiUnderTest.putPolicy(POLICY_TYPE_1_ID, POLICY_1_ID, POLICY_DATA, RIC_1_ID);
- assertNull(returnedResp.getBody());
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- }
-
- private void whenDeleteReturnOK(String url, HttpStatus status) {
- ResponseEntity<String> ret = new ResponseEntity<>(status);
- when(restClient.deleteForEntity(eq(url))).thenReturn(Mono.just(ret));
- }
-
- private void whenDeleteReturnFailure(String url, HttpStatus status, String body) {
- HttpServerErrorException e =
- new HttpServerErrorException(status, body, body.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
- when(restClient.deleteForEntity(eq(url))).thenReturn(Mono.error(e));
- }
-
- private String deletePolicyUrl(String id) {
- return "/a1-policy/v2/policies/" + id;
- }
-
- @Test
- void testDeletePolicyFailure() {
- whenDeleteReturnFailure(deletePolicyUrl(POLICY_1_ID), HttpStatus.NOT_FOUND, CLIENT_ERROR_MESSAGE);
-
- ResponseEntity<String> returnedResp = apiUnderTest.deletePolicy(POLICY_1_ID);
-
- assertTrue(returnedResp.getBody().contains(CLIENT_ERROR_MESSAGE));
- assertEquals(HttpStatus.NOT_FOUND, returnedResp.getStatusCode());
- }
-
- @Test
- void testDeletePolicySuccess() {
- whenDeleteReturnOK(deletePolicyUrl(POLICY_1_ID), HttpStatus.OK);
- ResponseEntity<String> returnedResp = apiUnderTest.deletePolicy(POLICY_1_ID);
-
- assertEquals(HttpStatus.OK, returnedResp.getStatusCode());
- }
-
- private String urlRicInfo(String typeName) {
- return "/a1-policy/v2/rics?policytype_id=" + typeName;
- }
-
- @Test
- void testGetRicsSupportingTypeValidJson() {
- String rics = Arrays.asList(RIC_1_INFO_VALID).toString();
- String returnVal = "{\"rics\":" + rics + "}";
- this.whenGetReturnOK(urlRicInfo(POLICY_TYPE_1_ID), HttpStatus.OK, returnVal);
-
- ResponseEntity<String> resp = apiUnderTest.getRicsSupportingType(POLICY_TYPE_1_ID);
-
- assertEquals(HttpStatus.OK, resp.getStatusCode());
- assertEquals("[\"ric1\"]", resp.getBody());
- }
-
- @Test
- void testGetRicsSupportingTypeInvalidJson() {
- String rics = Arrays.asList(RIC_1_INFO_INVALID).toString();
-
- this.whenGetReturnOK(urlRicInfo(POLICY_TYPE_1_ID), HttpStatus.OK, rics);
-
- ResponseEntity<String> returnedResp = apiUnderTest.getRicsSupportingType(POLICY_TYPE_1_ID);
-
- assertTrue(returnedResp.getBody().contains("Exception"));
- assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, returnedResp.getStatusCode());
- }
-
- private String parsePolicyInstancesJson(String inputString) {
- JsonArray arr = JsonParser.parseString(inputString).getAsJsonArray();
- PolicyInstances res = new PolicyInstances();
- JsonElement data = JsonParser.parseString(POLICY_DATA).getAsJsonObject();
- for (JsonElement id : arr) {
- PolicyInfo i = PolicyInfo.builder() //
- .policyId(id.getAsString()) //
- .policyTypeId(POLICY_TYPE_1_ID) //
- .ricId(RIC_1_ID) //
- .policyData(data) //
- .serviceId(SERVICE_ID) //
- .lastModified(TIMESTAMP) //
- .build(); //
- res.add(i);
- }
- return gson.toJson(res);
- }
-}
+++ /dev/null
-/*-
- * ========================LICENSE_START=================================
- * O-RAN-SC
- * %%
- * Copyright (C) 2020 Nordix Foundation
- * %%
- * 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.oransc.portal.nonrtric.controlpanel.util;
-
-import io.netty.util.internal.logging.InternalLoggerFactory;
-import io.netty.util.internal.logging.JdkLoggerFactory;
-
-import java.io.IOException;
-
-import okhttp3.mockwebserver.MockResponse;
-import okhttp3.mockwebserver.MockWebServer;
-
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-import reactor.util.Loggers;
-
-class AsyncRestClientTest {
- private static final String BASE_URL = "BaseUrl";
- private static final String REQUEST_URL = "/test";
- private static final String TEST_JSON = "{\"type\":\"type1\"}";
- private static final int SUCCESS_CODE = 200;
- private static final int ERROR_CODE = 500;
-
- private static MockWebServer mockWebServer;
-
- private static AsyncRestClient clientUnderTest;
-
- @BeforeAll
- public static void init() {
- // skip a lot of unnecessary logs from MockWebServer
- InternalLoggerFactory.setDefaultFactory(JdkLoggerFactory.INSTANCE);
- Loggers.useJdkLoggers();
- mockWebServer = new MockWebServer();
- clientUnderTest = new AsyncRestClient(mockWebServer.url(BASE_URL).toString());
- }
-
- @AfterAll
- public static void tearDown() throws IOException {
- mockWebServer.shutdown();
- }
-
- @Test
- void testGetNoError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
- .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
- .setBody(TEST_JSON));
-
- Mono<String> returnedMono = clientUnderTest.get(REQUEST_URL);
- StepVerifier.create(returnedMono).expectNext(TEST_JSON).expectComplete().verify();
- }
-
- @Test
- void testGetError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
-
- Mono<String> returnedMono = clientUnderTest.get(REQUEST_URL);
- StepVerifier.create(returnedMono)
- .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify();
- }
-
- @Test
- void testPutNoError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
- .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
- .setBody(TEST_JSON));
-
- Mono<String> returnedMono = clientUnderTest.put(REQUEST_URL, TEST_JSON);
- StepVerifier.create(returnedMono).expectNext(TEST_JSON).expectComplete().verify();
- }
-
- @Test
- void testPutWithoutBodyNoError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
- .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
-
- Mono<ResponseEntity<String>> returnedMono = clientUnderTest.putForEntity(REQUEST_URL);
- StepVerifier.create(returnedMono).expectNextCount(1).expectComplete().verify();
- }
-
- @Test
- void testPutError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
-
- Mono<String> returnedMono = clientUnderTest.put(REQUEST_URL, TEST_JSON);
- StepVerifier.create(returnedMono)
- .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify();
- }
-
- @Test
- void testDeleteNoError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE));
-
- Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
- StepVerifier.create(returnedMono).expectNext("").expectComplete().verify();
- }
-
- @Test
- void testDeleteError() {
- mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
-
- Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
- StepVerifier.create(returnedMono)
- .expectErrorMatches(throwable -> throwable instanceof WebClientResponseException).verify();
- }
-
-}
+++ /dev/null
-{
- "kind": "PodList",
- "apiVersion": "v1",
- "metadata": {
- "selfLink": "/api/v1/namespaces/ricaux/pods",
- "resourceVersion": "1594484"
- },
- "items": []
-}
+++ /dev/null
-{
- "kind": "PodList",
- "apiVersion": "v1",
- "metadata": {
- "selfLink": "/api/v1/namespaces/ricplt/pods",
- "resourceVersion": "3189380"
- },
- "items": [
- {
- "metadata": {
- "name": "deployment-ricplt-a1mediator-74d9fc4c8c-77vtp",
- "generateName": "deployment-ricplt-a1mediator-74d9fc4c8c-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-a1mediator-74d9fc4c8c-77vtp",
- "uid": "487c582d-36d6-406a-92a3-bfbce04b83de",
- "resourceVersion": "2945631",
- "creationTimestamp": "2019-10-18T16:15:04Z",
- "labels": {
- "app": "ricplt-a1mediator",
- "group": "nagios",
- "pod-template-hash": "74d9fc4c8c",
- "release": "r1-a1mediator"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-a1mediator-74d9fc4c8c",
- "uid": "84ef8695-3eb2-4dcd-b214-9d00ab5fb6b3",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "a1conf",
- "configMap": {
- "name": "configmap-ricplt-a1mediator-a1conf",
- "defaultMode": 420
- }
- },
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-a1mediator",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-a1:0.10.3",
- "ports": [
- {
- "name": "http",
- "containerPort": 10000,
- "protocol": "TCP"
- },
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 4562,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-a1mediator-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "a1conf",
- "mountPath": "/opt/ricmanifest.json",
- "subPath": "ricmanifest.json"
- },
- {
- "name": "a1conf",
- "mountPath": "/opt/rmr_string_int_mapping.txt",
- "subPath": "rmr_string_int_mapping.txt"
- },
- {
- "name": "a1conf",
- "mountPath": "/opt/route/local.rt",
- "subPath": "local.rt"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "livenessProbe": {
- "httpGet": {
- "path": "/a1-p/healthcheck",
- "port": "http",
- "scheme": "HTTP"
- },
- "timeoutSeconds": 1,
- "periodSeconds": 10,
- "successThreshold": 1,
- "failureThreshold": 3
- },
- "readinessProbe": {
- "httpGet": {
- "path": "/a1-p/healthcheck",
- "port": "http",
- "scheme": "HTTP"
- },
- "timeoutSeconds": 1,
- "periodSeconds": 10,
- "successThreshold": 1,
- "failureThreshold": 3
- },
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.202",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "a1mediator",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:04Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:09Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:09Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:04Z"
- }
- ],
- "hostIP": "172.29.16.202",
- "podIP": "10.244.4.71",
- "podIPs": [
- {
- "ip": "10.244.4.71"
- }
- ],
- "startTime": "2019-10-18T16:15:04Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-a1mediator",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:05Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-a1:0.10.3",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-a1@sha256:64a61ed84d4d05dfa1690bb45949da333d7b088e2e12dbba0ce60c06445f52cb",
- "containerID": "docker://07ceed10ee2a4413c167951e458b59a505a073cce82ac543146e58b698489d59",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-appmgr-6ccf55b98b-kbkt4",
- "generateName": "deployment-ricplt-appmgr-6ccf55b98b-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-appmgr-6ccf55b98b-kbkt4",
- "uid": "4e084e8a-eb0a-4ea2-9cc1-7f812cd6bb28",
- "resourceVersion": "2945633",
- "creationTimestamp": "2019-10-18T16:15:01Z",
- "labels": {
- "app": "ricplt-appmgr",
- "group": "nagios",
- "pod-template-hash": "6ccf55b98b",
- "release": "r1-appmgr"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-appmgr-6ccf55b98b",
- "uid": "a169ebc4-9b7c-4b8d-81ed-6364e07df24e",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "config-volume",
- "configMap": {
- "name": "configmap-ricplt-appmgr-appconfig",
- "defaultMode": 420
- }
- },
- {
- "name": "cert-volume",
- "configMap": {
- "name": "xapp-mgr-certs",
- "defaultMode": 420
- }
- },
- {
- "name": "secret-volume",
- "secret": {
- "secretName": "xapp-mgr-creds",
- "defaultMode": 420
- }
- },
- {
- "name": "helm-secret-volume",
- "emptyDir": {
-
- }
- },
- {
- "name": "appmgr-bin-volume",
- "configMap": {
- "name": "configmap-ricplt-appmgr-bin",
- "defaultMode": 493
- }
- },
- {
- "name": "svcacct-ricplt-appmgr-token-kclzw",
- "secret": {
- "secretName": "svcacct-ricplt-appmgr-token-kclzw",
- "defaultMode": 420
- }
- }
- ],
- "initContainers": [
- {
- "name": "container-ricplt-appmgr-copy-tiller-secret",
- "image": "registry.kube-system.svc.rec.io:5555/ric/it-dep-init:0.0.1",
- "command": [
- "/appmgr-tiller-secret-copier.sh"
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-appmgr-env"
- }
- }
- ],
- "env": [
- {
- "name": "SVCACCT_NAME",
- "value": "svcacct-ricplt-appmgr"
- },
- {
- "name": "CLUSTER_NAME",
- "value": "kubernetes"
- },
- {
- "name": "KUBECONFIG",
- "value": "/tmp/kubeconfig"
- },
- {
- "name": "K8S_API_HOST",
- "value": "https://10.254.0.1:443"
- },
- {
- "name": "SECRET_NAMESPACE",
- "value": "ricinfra"
- },
- {
- "name": "SECRET_NAME",
- "value": "secret-helm-client-ricxapp"
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "helm-secret-volume",
- "mountPath": "/opt/ric/secret"
- },
- {
- "name": "appmgr-bin-volume",
- "mountPath": "/svcacct-to-kubeconfig.sh",
- "subPath": "svcacct-to-kubeconfig.sh"
- },
- {
- "name": "appmgr-bin-volume",
- "mountPath": "/appmgr-tiller-secret-copier.sh",
- "subPath": "appmgr-tiller-secret-copier.sh"
- },
- {
- "name": "svcacct-ricplt-appmgr-token-kclzw",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "IfNotPresent"
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-appmgr",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-appmgr:0.1.9",
- "ports": [
- {
- "name": "http",
- "containerPort": 8080,
- "protocol": "TCP"
- },
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 4560,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-appmgr-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "config-volume",
- "mountPath": "/opt/ric/config/appmgr.yaml",
- "subPath": "appmgr.yaml"
- },
- {
- "name": "cert-volume",
- "mountPath": "/opt/ric/certificates"
- },
- {
- "name": "helm-secret-volume",
- "mountPath": "/opt/ric/secret"
- },
- {
- "name": "secret-volume",
- "mountPath": "/opt/ric/secret/helm_repo_username",
- "subPath": "helm_repo_username"
- },
- {
- "name": "secret-volume",
- "mountPath": "/opt/ric/secret/helm_repo_password",
- "subPath": "helm_repo_password"
- },
- {
- "name": "svcacct-ricplt-appmgr-token-kclzw",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "svcacct-ricplt-appmgr",
- "serviceAccount": "svcacct-ricplt-appmgr",
- "nodeName": "172.29.16.203",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "appmgr",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:03Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:04Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:04Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:01Z"
- }
- ],
- "hostIP": "172.29.16.203",
- "podIP": "10.244.3.252",
- "podIPs": [
- {
- "ip": "10.244.3.252"
- }
- ],
- "startTime": "2019-10-18T16:15:01Z",
- "initContainerStatuses": [
- {
- "name": "container-ricplt-appmgr-copy-tiller-secret",
- "state": {
- "terminated": {
- "exitCode": 0,
- "reason": "Completed",
- "startedAt": "2019-10-18T16:15:02Z",
- "finishedAt": "2019-10-18T16:15:02Z",
- "containerID": "docker://130db0adfad526204726bf11fe24741d94f11f39f97f0d826b066ec852e5a452"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/it-dep-init:0.0.1",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/it-dep-init@sha256:d3a2c02660a0b5da5a7e38626c49018ca7f5e3bc39106b0728ff72245cd20be5",
- "containerID": "docker://130db0adfad526204726bf11fe24741d94f11f39f97f0d826b066ec852e5a452"
- }
- ],
- "containerStatuses": [
- {
- "name": "container-ricplt-appmgr",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:03Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-appmgr:0.1.9",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-appmgr@sha256:5c076f702d570b385d10200cda8d504475ce44eb1bcbb131b1d50e00eabae4d7",
- "containerID": "docker://791f455c1974a100aaa09ab0a290e438d75aa1c3aadcb717c42d53e02cdedb83",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-dbaas-d4c9f7b88-7wgb9",
- "generateName": "deployment-ricplt-dbaas-d4c9f7b88-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-dbaas-d4c9f7b88-7wgb9",
- "uid": "e54e51fc-c4bd-4308-805e-16c2d588dacd",
- "resourceVersion": "2945634",
- "creationTimestamp": "2019-10-18T16:15:01Z",
- "labels": {
- "app": "ricplt-dbaas",
- "group": "nagios",
- "pod-template-hash": "d4c9f7b88",
- "release": "r1-dbaas"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-dbaas-d4c9f7b88",
- "uid": "7e8d5d34-efa9-41fe-b92f-d9b71bc40360",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-dbaas",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-dbaas:0.1.0",
- "ports": [
- {
- "name": "sql",
- "containerPort": 6379,
- "protocol": "TCP"
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 0,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.202",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:01Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:03Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:03Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:01Z"
- }
- ],
- "hostIP": "172.29.16.202",
- "podIP": "10.244.4.70",
- "podIPs": [
- {
- "ip": "10.244.4.70"
- }
- ],
- "startTime": "2019-10-18T16:15:01Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-dbaas",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:02Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-dbaas:0.1.0",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-dbaas@sha256:f63cfa353f355155ec6455a68d18c631900a2602bf7cc2ba35d6210971736b76",
- "containerID": "docker://8972d8b61d5c3ff56b50814575647d70fb3307602506cda3e34b6734c28a3f36",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-e2mgr-86c76477c5-mf5t5",
- "generateName": "deployment-ricplt-e2mgr-86c76477c5-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-e2mgr-86c76477c5-mf5t5",
- "uid": "5f2231ea-bec0-46fc-a8f8-09b0b80e982f",
- "resourceVersion": "2945636",
- "creationTimestamp": "2019-10-18T16:15:02Z",
- "labels": {
- "app": "ricplt-e2mgr",
- "group": "nagios",
- "pod-template-hash": "86c76477c5",
- "release": "r1-e2mgr"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-e2mgr-86c76477c5",
- "uid": "f7dfd4a3-4eb3-4c46-a6c8-adc4ae37ef57",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "local-router-file",
- "configMap": {
- "name": "configmap-ricplt-e2mgr-router-configmap",
- "defaultMode": 420
- }
- },
- {
- "name": "local-configuration-file",
- "configMap": {
- "name": "configmap-ricplt-e2mgr-configuration-configmap",
- "defaultMode": 420
- }
- },
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-e2mgr",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-e2mgr:2.0.7",
- "ports": [
- {
- "name": "http",
- "containerPort": 3800,
- "protocol": "TCP"
- },
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 3801,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-e2mgr-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "local-router-file",
- "mountPath": "/opt/E2Manager/router.txt",
- "subPath": "router.txt"
- },
- {
- "name": "local-configuration-file",
- "mountPath": "/opt/E2Manager/resources/configuration.yaml",
- "subPath": "configuration.yaml"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always",
- "securityContext": {
- "privileged": false
- },
- "stdin": true,
- "tty": true
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.204",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "e2mgr",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:02Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:05Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:05Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:02Z"
- }
- ],
- "hostIP": "172.29.16.204",
- "podIP": "10.244.2.100",
- "podIPs": [
- {
- "ip": "10.244.2.100"
- }
- ],
- "startTime": "2019-10-18T16:15:02Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-e2mgr",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:04Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-e2mgr:2.0.7",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-e2mgr@sha256:87fa19a934215bdec71a355ef08eec9e273c992bab80af727f4f1b7a74ebacfa",
- "containerID": "docker://ff3a2fcfc72b00e3c317899f2b620da2f65e3de260623daed7825f6a74dbcb5c",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-e2term-5dcf8b54b-5mkxl",
- "generateName": "deployment-ricplt-e2term-5dcf8b54b-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-e2term-5dcf8b54b-5mkxl",
- "uid": "8fae1dcd-5e42-4a66-be6f-e893d5563689",
- "resourceVersion": "2945639",
- "creationTimestamp": "2019-10-18T16:15:03Z",
- "labels": {
- "app": "ricplt-e2term",
- "group": "nagios",
- "pod-template-hash": "5dcf8b54b",
- "release": "r1-e2term"
- },
- "annotations": {
- "danm.k8s.io/interfaces": "[\n {\"clusterNetwork\":\"default\", \"ip\":\"dynamic\"},\n {\"clusterNetwork\":\"ran\", \"ip\":\"dynamic\", \"ip6\":\"dynamic\"}\n]\n",
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-e2term-5dcf8b54b",
- "uid": "cc20b8a0-6d74-4fb9-b384-bdce9c9ae184",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "local-router-file",
- "configMap": {
- "name": "configmap-ricplt-e2term-router-configmap",
- "defaultMode": 420
- }
- },
- {
- "name": "localtime",
- "hostPath": {
- "path": "/etc/localtime",
- "type": ""
- }
- },
- {
- "name": "pizpub-config",
- "configMap": {
- "name": "configmap-ricplt-e2term-pizpub",
- "defaultMode": 420
- }
- },
- {
- "name": "vol-shared",
- "persistentVolumeClaim": {
- "claimName": "pvc-ricplt-e2term"
- }
- },
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-e2term",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-e2:2.0.7.5",
- "ports": [
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 38000,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-e2term-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "local-router-file",
- "mountPath": "/opt/e2/router.txt",
- "subPath": "router.txt"
- },
- {
- "name": "local-router-file",
- "mountPath": "/tmp/rmr_verbose",
- "subPath": "rmr_verbose"
- },
- {
- "name": "vol-shared",
- "mountPath": "/data/outgoing/",
- "subPath": "outgoing"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always",
- "securityContext": {
- "privileged": false
- },
- "stdin": true,
- "tty": true
- },
- {
- "name": "container-ricplt-e2term-pizpub",
- "image": "registry.kube-system.svc.rec.io:5555/ric/pizpub:0.0.5155",
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "localtime",
- "readOnly": true,
- "mountPath": "/etc/localtime"
- },
- {
- "name": "vol-shared",
- "mountPath": "/data"
- },
- {
- "name": "pizpub-config",
- "mountPath": "/opt/app/config/conf/"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "lifecycle": {
- "postStart": {
- "exec": {
- "command": [
- "/bin/sh",
- "/opt/app/config/conf/cleaner.sh",
- "/data/sent",
- "3"
- ]
- }
- }
- },
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirstWithHostNet",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.201",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "e2term",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:22Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:33Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:33Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:22Z"
- }
- ],
- "hostIP": "172.29.16.201",
- "podIP": "10.244.1.90",
- "podIPs": [
- {
- "ip": "10.244.1.90"
- }
- ],
- "startTime": "2019-10-18T16:15:22Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-e2term",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:31Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "ranco-dev-tools.eastus.cloudapp.azure.com:10001/ric-plt-e2:2.0.7.5",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-e2@sha256:0ea1a356d018495a93e124ddd793e09626bf6e4d9b96355e731673ef7fab5a1f",
- "containerID": "docker://bf9ca87dbad9436b0ed99ffe38036fb49033a9bc2cf2eb548397fbc9c48f1c3d",
- "started": true
- },
- {
- "name": "container-ricplt-e2term-pizpub",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:32Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "ranco-dev-tools.eastus.cloudapp.azure.com:10001/pizpub:0.0.5155",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/pizpub@sha256:138c2d2d25e6528c4a5a8a402c277722d1c1fd4d6792b644967acd538affb1ed",
- "containerID": "docker://93e39661623b7afc8156008bb6fbc206458964a6eb0633f80164e4c7ef59fe76",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-jaegeradapter-6ff8676c7-m4qkf",
- "generateName": "deployment-ricplt-jaegeradapter-6ff8676c7-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-jaegeradapter-6ff8676c7-m4qkf",
- "uid": "d6a5e9e9-87d0-4d1e-b1b7-cc1a4f20dc2e",
- "resourceVersion": "2945640",
- "creationTimestamp": "2019-10-18T16:15:08Z",
- "labels": {
- "app": "ricplt-jaegeradapter",
- "group": "nagios",
- "pod-template-hash": "6ff8676c7",
- "release": "r1-jaegeradapter"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-jaegeradapter-6ff8676c7",
- "uid": "98bc03d7-a082-4ac1-9b89-064022a37dff",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-jaegeradapter",
- "image": "registry.kube-system.svc.rec.io:5555/ric/all-in-one:1.12",
- "ports": [
- {
- "name": "zipkincompact",
- "containerPort": 5775,
- "protocol": "UDP"
- },
- {
- "name": "jaegercompact",
- "containerPort": 6831,
- "protocol": "UDP"
- },
- {
- "name": "jaegerbinary",
- "containerPort": 6832,
- "protocol": "UDP"
- },
- {
- "name": "httpquery",
- "containerPort": 16686,
- "protocol": "TCP"
- },
- {
- "name": "httpconfig",
- "containerPort": 5778,
- "protocol": "TCP"
- },
- {
- "name": "zipkinhttp",
- "containerPort": 9411,
- "protocol": "TCP"
- },
- {
- "name": "jaegerhttp",
- "containerPort": 14268,
- "protocol": "TCP"
- },
- {
- "name": "jaegerhttpt",
- "containerPort": 14267,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-jaegeradapter"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "livenessProbe": {
- "httpGet": {
- "path": "/",
- "port": 16686,
- "scheme": "HTTP"
- },
- "timeoutSeconds": 1,
- "periodSeconds": 10,
- "successThreshold": 1,
- "failureThreshold": 3
- },
- "readinessProbe": {
- "httpGet": {
- "path": "/",
- "port": 16686,
- "scheme": "HTTP"
- },
- "timeoutSeconds": 1,
- "periodSeconds": 10,
- "successThreshold": 1,
- "failureThreshold": 3
- },
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.203",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "jaegeradapter",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:08Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:15Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:15Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:08Z"
- }
- ],
- "hostIP": "172.29.16.203",
- "podIP": "10.244.3.254",
- "podIPs": [
- {
- "ip": "10.244.3.254"
- }
- ],
- "startTime": "2019-10-18T16:15:08Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-jaegeradapter",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:09Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/all-in-one:1.12",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/all-in-one@sha256:51b901b653f4a4ca5dd50be9133c08dacf2d3eb092e507c213e7955a0e132297",
- "containerID": "docker://95013a49a1705a503f5f7dde7a38fa7277523a73cdef96d264fcefe170e8a921",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-rsm-88477585f-qkkj7",
- "generateName": "deployment-ricplt-rsm-88477585f-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-rsm-88477585f-qkkj7",
- "uid": "d4c58ff4-743e-4ed6-bd36-aeb02daa1ca6",
- "resourceVersion": "2945642",
- "creationTimestamp": "2019-10-18T16:15:07Z",
- "labels": {
- "app": "ricplt-rsm",
- "group": "nagios",
- "pod-template-hash": "88477585f",
- "release": "r1-rsm"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-rsm-88477585f",
- "uid": "1fe7de57-90d9-4898-9b71-1ae9c4a6f014",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "local-router-file",
- "configMap": {
- "name": "configmap-ricplt-rsm-router-configmap",
- "defaultMode": 420
- }
- },
- {
- "name": "local-configuration-file",
- "configMap": {
- "name": "configmap-ricplt-rsm",
- "defaultMode": 420
- }
- },
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-rsm",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-rsm:2.0.7",
- "ports": [
- {
- "name": "http",
- "containerPort": 4800,
- "protocol": "TCP"
- },
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 4801,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-rsm-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "local-router-file",
- "mountPath": "/opt/RSM/router.txt",
- "subPath": "router.txt"
- },
- {
- "name": "local-configuration-file",
- "mountPath": "/opt/RSM/resources/configuration.yaml",
- "subPath": "configuration.yaml"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always",
- "securityContext": {
- "privileged": false
- },
- "stdin": true,
- "tty": true
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.203",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "rsm",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:07Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:09Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:09Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:07Z"
- }
- ],
- "hostIP": "172.29.16.203",
- "podIP": "10.244.3.253",
- "podIPs": [
- {
- "ip": "10.244.3.253"
- }
- ],
- "startTime": "2019-10-18T16:15:07Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-rsm",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:08Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-rsm:2.0.7",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-rsm@sha256:e6fb3bc17fcd5a2fbc7d34eeb744fbfed4eaaaf6c669e084b379ee05368820d3",
- "containerID": "docker://5e90673a6b2c292f2ce7c731bf8747c8a63f429eca08d08a993130001c7d6f5e",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-submgr-7549b87fb8-4t6mx",
- "generateName": "deployment-ricplt-submgr-7549b87fb8-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-submgr-7549b87fb8-4t6mx",
- "uid": "c6fbd48b-2757-421c-a534-f1931b04312b",
- "resourceVersion": "2945646",
- "creationTimestamp": "2019-10-18T16:15:05Z",
- "labels": {
- "app": "ricplt-submgr",
- "group": "nagios",
- "pod-template-hash": "7549b87fb8",
- "release": "r1-submgr"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-submgr-7549b87fb8",
- "uid": "e2b9dd9f-cca4-4f64-9e11-b6ee174c4f6f",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "config-volume",
- "configMap": {
- "name": "submgrcfg",
- "items": [
- {
- "key": "submgrcfg",
- "path": "submgr-config.yaml",
- "mode": 420
- }
- ],
- "defaultMode": 420
- }
- },
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-submgr",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-submgr:0.10.5",
- "command": [
- "/run_submgr.sh"
- ],
- "ports": [
- {
- "name": "http",
- "containerPort": 3800,
- "protocol": "TCP"
- },
- {
- "name": "rmrroute",
- "containerPort": 4561,
- "protocol": "TCP"
- },
- {
- "name": "rmrdata",
- "containerPort": 4560,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-submgr-env"
- }
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "config-volume",
- "mountPath": "/cfg"
- },
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.205",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "submgr",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:05Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:07Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:07Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:05Z"
- }
- ],
- "hostIP": "172.29.16.205",
- "podIP": "10.244.0.168",
- "podIPs": [
- {
- "ip": "10.244.0.168"
- }
- ],
- "startTime": "2019-10-18T16:15:05Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-submgr",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:07Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-submgr:0.10.5",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-submgr@sha256:aa8ada253d0800a849b6124fc54793815caaf93ad46b8d47cdd1f590ef69f813",
- "containerID": "docker://724ba7834ef80d1f3c85ae7990ead480ed5226f0275816bae358edc9ddf54da6",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- },
- {
- "metadata": {
- "name": "deployment-ricplt-vespamgr-55f6484b7-g5zfw",
- "generateName": "deployment-ricplt-vespamgr-55f6484b7-",
- "namespace": "ricplt",
- "selfLink": "/api/v1/namespaces/ricplt/pods/deployment-ricplt-vespamgr-55f6484b7-g5zfw",
- "uid": "a7ae0f4a-adfa-48c6-8c41-725ba1c84b11",
- "resourceVersion": "2945649",
- "creationTimestamp": "2019-10-18T16:15:06Z",
- "labels": {
- "app": "ricplt-vespamgr",
- "group": "nagios",
- "pod-template-hash": "55f6484b7",
- "release": "r1-vespamgr"
- },
- "annotations": {
- "kubernetes.io/psp": "caas-default"
- },
- "ownerReferences": [
- {
- "apiVersion": "apps/v1",
- "kind": "ReplicaSet",
- "name": "deployment-ricplt-vespamgr-55f6484b7",
- "uid": "dc5e0e81-23da-4fed-99da-14cb7a8fe06c",
- "controller": true,
- "blockOwnerDeletion": true
- }
- ]
- },
- "spec": {
- "volumes": [
- {
- "name": "default-token-5j24g",
- "secret": {
- "secretName": "default-token-5j24g",
- "defaultMode": 420
- }
- }
- ],
- "containers": [
- {
- "name": "container-ricplt-vespamgr",
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-vespamgr:0.0.5",
- "ports": [
- {
- "name": "http",
- "containerPort": 8080,
- "protocol": "TCP"
- }
- ],
- "envFrom": [
- {
- "configMapRef": {
- "name": "configmap-ricplt-vespamgr"
- }
- },
- {
- "secretRef": {
- "name": "vespa-secrets"
- }
- }
- ],
- "env": [
- {
- "name": "VESMGR_APPMGRDOMAIN",
- "value": "appmgr-service"
- }
- ],
- "resources": {
-
- },
- "volumeMounts": [
- {
- "name": "default-token-5j24g",
- "readOnly": true,
- "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
- }
- ],
- "livenessProbe": {
- "httpGet": {
- "path": "/supervision",
- "port": 8080,
- "scheme": "HTTP"
- },
- "initialDelaySeconds": 30,
- "timeoutSeconds": 20,
- "periodSeconds": 60,
- "successThreshold": 1,
- "failureThreshold": 3
- },
- "terminationMessagePath": "/dev/termination-log",
- "terminationMessagePolicy": "File",
- "imagePullPolicy": "Always"
- }
- ],
- "restartPolicy": "Always",
- "terminationGracePeriodSeconds": 30,
- "dnsPolicy": "ClusterFirst",
- "serviceAccountName": "default",
- "serviceAccount": "default",
- "nodeName": "172.29.16.204",
- "securityContext": {
-
- },
- "imagePullSecrets": [
- {
- "name": "docker-reg-cred"
- }
- ],
- "hostname": "vespamgr",
- "schedulerName": "default-scheduler",
- "enableServiceLinks": true
- },
- "status": {
- "phase": "Running",
- "conditions": [
- {
- "type": "Initialized",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:06Z"
- },
- {
- "type": "Ready",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:08Z"
- },
- {
- "type": "ContainersReady",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:08Z"
- },
- {
- "type": "PodScheduled",
- "status": "True",
- "lastProbeTime": null,
- "lastTransitionTime": "2019-10-18T16:15:06Z"
- }
- ],
- "hostIP": "172.29.16.204",
- "podIP": "10.244.2.101",
- "podIPs": [
- {
- "ip": "10.244.2.101"
- }
- ],
- "startTime": "2019-10-18T16:15:06Z",
- "containerStatuses": [
- {
- "name": "container-ricplt-vespamgr",
- "state": {
- "running": {
- "startedAt": "2019-10-18T16:15:08Z"
- }
- },
- "lastState": {
-
- },
- "ready": true,
- "restartCount": 0,
- "image": "registry.kube-system.svc.rec.io:5555/ric/ric-plt-vespamgr:0.0.5",
- "imageID": "docker-pullable://registry.kube-system.svc.rec.io:5555/ric/ric-plt-vespamgr@sha256:97753ef72471a5fddd59ff35a2fe763b041848f6e83214acb78ad73c7316b371",
- "containerID": "docker://80884c969cbf802945c075afc47d747b5e747e4645c691d376820c9d61094e7c",
- "started": true
- }
- ],
- "qosClass": "BestEffort"
- }
- }
- ]
-}
\ No newline at end of file
+++ /dev/null
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Example_QoSTarget_1.0.0",
- "description": "Example QoS Target policy type",
- "type": "object",
- "properties": {
- "scope": {
- "type": "object",
- "properties": {
- "qosId": {
- "type": "string"
- },
- "cellId": {
- "type": "string"
- }
- },
- "additionalProperties": false,
- "required": [
- "qosId"
- ]
- },
- "statement": {
- "type": "object",
- "properties": {
- "gfbr": {
- "type": "number"
- },
- "mfbr": {
- "type": "number"
- },
- "priorityLevel": {
- "type": "number"
- },
- "pdb": {
- "type": "number"
- }
- },
- "minProperties": 1,
- "additionalProperties": false
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Example_QoETarget_1.0.0",
- "description": "Example QoE Target policy type",
- "type": "object",
- "properties": {
- "scope": {
- "type": "object",
- "properties": {
- "ueId": {
- "type": "string"
- },
- "sliceId": {
- "type": "string"
- },
- "qosId": {
- "type": "string"
- },
- "cellId": {
- "type": "string"
- }
- },
- "additionalProperties": false,
- "required": [
- "ueId",
- "sliceId"
- ]
- },
- "statement": {
- "type": "object",
- "properties": {
- "qoeScore": {
- "type": "number"
- },
- "initialBuffering": {
- "type": "number"
- },
- "reBuffFreq": {
- "type": "number"
- },
- "stallRatio": {
- "type": "number"
- }
- },
- "minProperties": 1,
- "additionalProperties": false
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Example_TrafficSteeringPreference_1.0.0",
- "description": "Example Traffic Steering Preference policy type",
- "type": "object",
- "properties": {
- "scope": {
- "type": "object",
- "properties": {
- "ueId": {
- "type": "string"
- },
- "sliceId": {
- "type": "string"
- },
- "qosId": {
- "type": "string"
- },
- "cellId": {
- "type": "string"
- }
- },
- "additionalProperties": false,
- "required": [
- "ueId"
- ]
- },
- "statement": {
- "type": "object",
- "properties": {
- "cellIdList": {
- "type": "array",
- "minItems": 1,
- "uniqueItems": true,
- "items": {
- "type": "string"
- }
- },
- "preference": {
- "type": "string",
- "enum": [
- "SHALL",
- "PREFER",
- "AVOID",
- "FORBID"
- ]
- },
- "primary": {
- "type": "boolean"
- }
- },
- "required": [
- "cellIdList",
- "preference"
- ],
- "additionalProperties": false
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "STD_Type1_1.0.0",
- "description": "EI-Type 1",
- "type": "object"
-}
\ No newline at end of file
+++ /dev/null
-{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "STD_Type2_1.0.0",
- "description": "EI-Type 2",
- "type": "object"
-}
\ No newline at end of file
+++ /dev/null
-{
- "jobparam1":"value1",
- "jobparam2":"value2",
- "jobparam3":"value3"
-}
+++ /dev/null
-{
- "jobparam1":"value1",
- "jobparam2":"value2",
- "jobparam3":"value3"
-}
## Development server
Run `./ng serve --proxy-config proxy.conf.json` or `npm start` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+You may also need to Start the Control Panel Gateway,Policy Management Service & EI Coordinator if you want to view the data in UI.
## Development server with Mock Data
Run `npm run start:mock` for a dev server with mock data. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. This enables the developer to test the UI without the need of backend.
include /etc/nginx/mime.types;
upstream backend {
- server nonrtricgateway:9090;
+ server nonrtric-gateway:9090;
}
server {
- listen 7070;
+ listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
{
- "/api": {
- "target": "http://localhost:8080",
+ "/a1-policy": {
+ "target": "http://localhost:9090",
"secure": false
- }
-}
+ },
+ "/ei-producer": {
+ "target": "http://localhost:9090",
+ "secure": false
+ }
+}
\ No newline at end of file