Renamed things to fit with namechange of RicSynchronizationTask
Change-Id: I6de98e23eac06b8a54a8dc706904b3650a5014ee
Issue-ID: NONRTRIC-117
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
diff --git a/policy-agent/docs/api.yaml b/policy-agent/docs/api.yaml
index a2f1b57..bd1ba68 100644
--- a/policy-agent/docs/api.yaml
+++ b/policy-agent/docs/api.yaml
@@ -425,7 +425,7 @@
- name: type
in: query
description: type
- required: true
+ required: false
type: string
responses:
'200':
@@ -444,10 +444,6 @@
description: RIC or policy type is not found
schema:
type: string
- '405':
- description: Change is not allowed
- schema:
- type: string
'423':
description: RIC is locked
schema:
@@ -762,7 +758,7 @@
post:
tags:
- Service registry and supervision
- summary: Keep the policies alive for a service
+ summary: Heartbeat from a serice
operationId: keepAliveServiceUsingPOST
consumes:
- application/json
@@ -776,7 +772,7 @@
type: string
responses:
'200':
- description: Policies timeout supervision refreshed
+ description: 'Service supervision timer refreshed, OK'
schema:
type: string
'201':
@@ -874,11 +870,11 @@
properties:
callbackUrl:
type: string
- description: callback for notifying of RIC recovery
+ description: callback for notifying of RIC synchronization
keepAliveIntervalSeconds:
type: integer
format: int64
- description: keep alive interval for policies owned by the service. 0 means no timeout supervision. Polcies that are not refreshed within this time are removed
+ description: 'keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a ''keepAlive'' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.'
serviceName:
type: string
description: identity of the service
@@ -888,7 +884,7 @@
properties:
callbackUrl:
type: string
- description: callback for notifying of RIC recovery
+ description: callback for notifying of RIC synchronization
keepAliveIntervalSeconds:
type: integer
format: int64
@@ -896,9 +892,8 @@
serviceName:
type: string
description: identity of the service
- timeSincePingSeconds:
+ timeSinceLastActivitySeconds:
type: integer
format: int64
description: time since last invocation by the service
title: ServiceStatus
-
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
index 8f9169d..0efec60 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
@@ -97,7 +97,7 @@
.onErrorResume(notUsed -> fetchVersion(createClient(ric, A1ProtocolType.SDNC_OSC))) //
.onErrorResume(notUsed -> fetchVersion(createClient(ric, A1ProtocolType.SDNC_ONAP))) //
.doOnNext(ric::setProtocolVersion)
- .doOnNext(version -> logger.debug("Recover ric: {}, protocol version:{}", ric.name(), version)) //
+ .doOnNext(version -> logger.debug("Established protocol version:{} for Ric: {}", version, ric.name())) //
.doOnError(notUsed -> logger.warn("Could not get protocol version from RIC: {}", ric.name())); //
} else {
return Mono.just(ric.getProtocolVersion());
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
index bc3aa81..0ef1679 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
@@ -182,7 +182,7 @@
policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceName());
if (policy.ric().getState() != Ric.RicState.IDLE) {
- return Mono.just(new ResponseEntity<>("Busy, recovering", HttpStatus.LOCKED));
+ return Mono.just(new ResponseEntity<>("Busy, synchronizing", HttpStatus.LOCKED));
}
Ric ric = policy.ric();
return ric.getLock().lock(LockType.SHARED) // //
@@ -242,7 +242,7 @@
}
return ric == null || type == null ? Mono.just(new ResponseEntity<>(HttpStatus.NOT_FOUND))
- : Mono.just(new ResponseEntity<>(HttpStatus.LOCKED)); // Recovering
+ : Mono.just(new ResponseEntity<>(HttpStatus.LOCKED)); // Synchronizing
}
@SuppressWarnings({"unchecked"})
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceRegistrationInfo.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceRegistrationInfo.java
index e532a36..1194e25 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceRegistrationInfo.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceRegistrationInfo.java
@@ -45,7 +45,7 @@
@SerializedName("keepAliveIntervalSeconds")
public long keepAliveIntervalSeconds = 0;
- @ApiModelProperty(value = "callback for notifying of RIC recovery", required = false, allowEmptyValue = true)
+ @ApiModelProperty(value = "callback for notifying of RIC synchronization", required = false, allowEmptyValue = true)
@SerializedName("callbackUrl")
public String callbackUrl = "";
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceStatus.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceStatus.java
index 8f4daac..42be574 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceStatus.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceStatus.java
@@ -38,7 +38,7 @@
@ApiModelProperty(value = "time since last invocation by the service")
public final long timeSinceLastActivitySeconds;
- @ApiModelProperty(value = "callback for notifying of RIC recovery")
+ @ApiModelProperty(value = "callback for notifying of RIC synchronization")
public String callbackUrl;
ServiceStatus(String name, long keepAliveIntervalSeconds, long timeSincePingSeconds, String callbackUrl) {
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/tasks/RicSynchronizationTask.java b/policy-agent/src/main/java/org/oransc/policyagent/tasks/RicSynchronizationTask.java
index a42135e..6110c58 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/tasks/RicSynchronizationTask.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/tasks/RicSynchronizationTask.java
@@ -95,11 +95,11 @@
}
private Flux<Object> startSynchronization(Ric ric, A1Client a1Client) {
- Flux<PolicyType> recoverTypes = synchronizePolicyTypes(ric, a1Client);
+ Flux<PolicyType> synchronizedTypes = synchronizePolicyTypes(ric, a1Client);
Flux<?> policiesDeletedInRic = a1Client.deleteAllPolicies();
Flux<?> policiesRecreatedInRic = recreateAllPoliciesInRic(ric, a1Client);
- return Flux.concat(recoverTypes, policiesDeletedInRic, policiesRecreatedInRic);
+ return Flux.concat(synchronizedTypes, policiesDeletedInRic, policiesRecreatedInRic);
}
private void onSynchronizationComplete(Ric ric) {
@@ -129,19 +129,19 @@
// If synchronization fails, try to remove all instances
deleteAllPoliciesInRepository(ric);
- Flux<PolicyType> recoverTypes = this.a1ClientFactory.createA1Client(ric) //
+ Flux<PolicyType> synchronizedTypes = this.a1ClientFactory.createA1Client(ric) //
.flatMapMany(a1Client -> synchronizePolicyTypes(ric, a1Client));
Flux<?> deletePoliciesInRic = this.a1ClientFactory.createA1Client(ric) //
.flatMapMany(A1Client::deleteAllPolicies) //
.doOnComplete(() -> deleteAllPoliciesInRepository(ric));
- Flux.concat(recoverTypes, deletePoliciesInRic) //
- .subscribe(x -> logger.debug("Brute recover: {}", x), //
- throwable -> onRecoveryError(ric, throwable), //
+ Flux.concat(synchronizedTypes, deletePoliciesInRic) //
+ .subscribe(x -> logger.debug("Brute recovery of failed synchronization: {}", x), //
+ throwable -> onSynchronizationRecoveryError(ric, throwable), //
() -> onSynchronizationComplete(ric));
}
- private void onRecoveryError(Ric ric, Throwable t) {
+ private void onSynchronizationRecoveryError(Ric ric, Throwable t) {
logger.warn("Synchronization failure recovery failed for ric: {}, reason: {}", ric.name(), t.getMessage());
ric.setState(RicState.UNDEFINED);
}
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java
index 5b6c5ba..2308fcf 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java
@@ -212,7 +212,7 @@
}
@Test
- public void testRecovery() throws Exception {
+ public void testSynchronization() throws Exception {
addRic("ric").setState(Ric.RicState.UNDEFINED);
String ricName = "ric";
Policy policy2 = addPolicy("policyId2", "typeName", "service", ricName);
diff --git a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
index 8d3dd94..7aef0c0 100644
--- a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
+++ b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
@@ -95,7 +95,7 @@
private A1ClientFactory a1ClientFactory;
@Mock
- private RicSynchronizationTask recoveryTaskMock;
+ private RicSynchronizationTask synchronizationTaskMock;
private final PolicyTypes types = new PolicyTypes();
private Policies policies = new Policies();
@@ -121,7 +121,7 @@
}
@Test
- public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoRecovery() {
+ public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@ -142,24 +142,24 @@
}
@Test
- public void whenRicUndefined_thenRecovery() {
+ public void whenRicUndefined_thenSynchronization() {
RIC_1.setState(RicState.UNDEFINED);
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
- doReturn(recoveryTaskMock).when(supervisorUnderTest).createSynchronizationTask();
+ doReturn(synchronizationTaskMock).when(supervisorUnderTest).createSynchronizationTask();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicRecovering_thenNoRecovery() {
+ public void whenRicSynchronizing_thenNoSynchronization() {
RIC_1.setState(RicState.SYNCHRONIZING);
rics.put(RIC_1);
@@ -172,7 +172,7 @@
}
@Test
- public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoRecovery() {
+ public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@ -187,7 +187,7 @@
}
@Test
- public void whenRicIdleAndNotSameAmountOfPolicies_thenRecovery() {
+ public void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
@@ -198,18 +198,18 @@
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
- doReturn(recoveryTaskMock).when(supervisorUnderTest).createSynchronizationTask();
+ doReturn(synchronizationTaskMock).when(supervisorUnderTest).createSynchronizationTask();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenRecovery() {
+ public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
@@ -220,18 +220,18 @@
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
- doReturn(recoveryTaskMock).when(supervisorUnderTest).createSynchronizationTask();
+ doReturn(synchronizationTaskMock).when(supervisorUnderTest).createSynchronizationTask();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicIdleAndErrorGettingPolicyTypes_thenNoRecovery() {
+ public void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@ -247,7 +247,7 @@
}
@Test
- public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenRecovery() {
+ public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@ -259,18 +259,18 @@
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
- doReturn(recoveryTaskMock).when(supervisorUnderTest).createSynchronizationTask();
+ doReturn(synchronizationTaskMock).when(supervisorUnderTest).createSynchronizationTask();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenRecovery() {
+ public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
.schema("") //
@@ -286,13 +286,13 @@
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
- doReturn(recoveryTaskMock).when(supervisorUnderTest).createSynchronizationTask();
+ doReturn(synchronizationTaskMock).when(supervisorUnderTest).createSynchronizationTask();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}