summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
deb5bb7)
Change-Id: I6de98e23eac06b8a54a8dc706904b3650a5014ee
Issue-ID: NONRTRIC-117
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
- name: type
in: query
description: type
- name: type
in: query
description: type
type: string
responses:
'200':
type: string
responses:
'200':
description: RIC or policy type is not found
schema:
type: string
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:
'423':
description: RIC is locked
schema:
post:
tags:
- Service registry and supervision
post:
tags:
- Service registry and supervision
- summary: Keep the policies alive for a service
+ summary: Heartbeat from a serice
operationId: keepAliveServiceUsingPOST
consumes:
- application/json
operationId: keepAliveServiceUsingPOST
consumes:
- application/json
type: string
responses:
'200':
type: string
responses:
'200':
- description: Policies timeout supervision refreshed
+ description: 'Service supervision timer refreshed, OK'
schema:
type: string
'201':
schema:
type: string
'201':
properties:
callbackUrl:
type: string
properties:
callbackUrl:
type: string
- description: callback for notifying of RIC recovery
+ description: callback for notifying of RIC synchronization
keepAliveIntervalSeconds:
type: integer
format: int64
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
serviceName:
type: string
description: identity of the service
properties:
callbackUrl:
type: string
properties:
callbackUrl:
type: string
- description: callback for notifying of RIC recovery
+ description: callback for notifying of RIC synchronization
keepAliveIntervalSeconds:
type: integer
format: int64
keepAliveIntervalSeconds:
type: integer
format: int64
serviceName:
type: string
description: identity of the service
serviceName:
type: string
description: identity of the service
+ timeSinceLastActivitySeconds:
type: integer
format: int64
description: time since last invocation by the service
title: ServiceStatus
type: integer
format: int64
description: time since last invocation by the service
title: ServiceStatus
.onErrorResume(notUsed -> fetchVersion(createClient(ric, A1ProtocolType.SDNC_OSC))) //
.onErrorResume(notUsed -> fetchVersion(createClient(ric, A1ProtocolType.SDNC_ONAP))) //
.doOnNext(ric::setProtocolVersion)
.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());
.doOnError(notUsed -> logger.warn("Could not get protocol version from RIC: {}", ric.name())); //
} else {
return Mono.just(ric.getProtocolVersion());
policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceName());
if (policy.ric().getState() != Ric.RicState.IDLE) {
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) // //
}
Ric ric = policy.ric();
return ric.getLock().lock(LockType.SHARED) // //
}
return ric == null || type == null ? Mono.just(new ResponseEntity<>(HttpStatus.NOT_FOUND))
}
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"})
}
@SuppressWarnings({"unchecked"})
@SerializedName("keepAliveIntervalSeconds")
public long keepAliveIntervalSeconds = 0;
@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 = "";
@SerializedName("callbackUrl")
public String callbackUrl = "";
@ApiModelProperty(value = "time since last invocation by the service")
public final long timeSinceLastActivitySeconds;
@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) {
public String callbackUrl;
ServiceStatus(String name, long keepAliveIntervalSeconds, long timeSincePingSeconds, String callbackUrl) {
}
private Flux<Object> startSynchronization(Ric ric, A1Client a1Client) {
}
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);
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) {
}
private void onSynchronizationComplete(Ric ric) {
// If synchronization fails, try to remove all instances
deleteAllPoliciesInRepository(ric);
// 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));
.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));
}
() -> 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);
}
logger.warn("Synchronization failure recovery failed for ric: {}, reason: {}", ric.name(), t.getMessage());
ric.setState(RicState.UNDEFINED);
}
- 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);
addRic("ric").setState(Ric.RicState.UNDEFINED);
String ricName = "ric";
Policy policy2 = addPolicy("policyId2", "typeName", "service", ricName);
private A1ClientFactory a1ClientFactory;
@Mock
private A1ClientFactory a1ClientFactory;
@Mock
- private RicSynchronizationTask recoveryTaskMock;
+ private RicSynchronizationTask synchronizationTaskMock;
private final PolicyTypes types = new PolicyTypes();
private Policies policies = new Policies();
private final PolicyTypes types = new PolicyTypes();
private Policies policies = new Policies();
- public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoRecovery() {
+ public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
- 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));
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();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicRecovering_thenNoRecovery() {
+ public void whenRicSynchronizing_thenNoSynchronization() {
RIC_1.setState(RicState.SYNCHRONIZING);
rics.put(RIC_1);
RIC_1.setState(RicState.SYNCHRONIZING);
rics.put(RIC_1);
- public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoRecovery() {
+ public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
- public void whenRicIdleAndNotSameAmountOfPolicies_thenRecovery() {
+ public void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
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();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenRecovery() {
+ public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
RIC_1.setState(RicState.IDLE);
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
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();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
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);
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
- public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenRecovery() {
+ public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.setState(RicState.IDLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
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();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
verifyNoMoreInteractions(supervisorUnderTest);
}
@Test
- public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenRecovery() {
+ public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
.schema("") //
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
.schema("") //
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
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();
supervisorUnderTest.checkAllRics();
verify(supervisorUnderTest).checkAllRics();
verify(supervisorUnderTest).createSynchronizationTask();
- verify(recoveryTaskMock).run(RIC_1);
+ verify(synchronizationTaskMock).run(RIC_1);
verifyNoMoreInteractions(supervisorUnderTest);
}
verifyNoMoreInteractions(supervisorUnderTest);
}