use of org.onap.so.client.namingservice.NamingRequestObject in project so by onap.
the class NamingServiceCreateTasks method createVpnBondingServiceName.
public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
namingRequestObject.setNetworkNameValue(network.getNetworkName());
namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
String generatedVpnBondingServiceName = "";
try {
generatedVpnBondingServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName);
}
use of org.onap.so.client.namingservice.NamingRequestObject in project so by onap.
the class NamingServiceDeleteTasks method deleteServiceInstanceName.
public void deleteServiceInstanceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
try {
namingServiceResources.deleteServiceInstanceName(namingRequestObject);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.client.namingservice.NamingRequestObject in project so by onap.
the class NamingServiceResourcesTest method deleteServiceInstanceNameTest.
@Test
public void deleteServiceInstanceNameTest() throws Exception {
NameGenDeleteRequest req = new NameGenDeleteRequest();
doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
NamingRequestObject nrObject = new NamingRequestObject();
nrObject.setExternalKeyValue("testExternalKey");
nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
namingServiceResources.deleteServiceInstanceName(nrObject);
verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class));
}
use of org.onap.so.client.namingservice.NamingRequestObject in project so by onap.
the class NamingServiceResourcesTest method generateServiceInstanceNameTest.
@Test
public void generateServiceInstanceNameTest() throws Exception {
NameGenRequest req = new NameGenRequest();
doReturn("generatedServiceInstanceName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class));
doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class));
NamingRequestObject nrObject = new NamingRequestObject();
nrObject.setExternalKeyValue("testExternalKey");
nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
nrObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
nrObject.setPolicyInstanceNameValue(execution.getVariable("policyInstanceName"));
nrObject.setServiceModelNameValue("testServiceInstanceModelName");
nrObject.setModelVersionValue("testServiceInstanceModelVersion");
nrObject.setZoneIdValue(execution.getVariable("zoneId"));
String generatedName = namingServiceResources.generateServiceInstanceName(nrObject);
verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class));
assertEquals("generatedServiceInstanceName", generatedName);
}
use of org.onap.so.client.namingservice.NamingRequestObject in project so by onap.
the class NamingServiceCreateTasks method createWanTransportServiceName.
public void createWanTransportServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
String generatedWanTransportServiceName = "";
try {
generatedWanTransportServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
serviceInstance.setServiceInstanceName(generatedWanTransportServiceName);
}
Aggregations