aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java54
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java4
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java20
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java1
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json1
-rw-r--r--common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java9
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java19
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java6
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java7
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java15
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java4
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java22
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java15
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java17
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java29
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java11
-rw-r--r--pom.xml2
22 files changed, 210 insertions, 71 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 3f5d25b93f..fae3539cb5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -67,6 +67,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.logging.filter.base.ErrorCode;
@@ -291,15 +292,15 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
}
lIf.setL2Multicasting(isL2Multicast);
+
+ transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
+ cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName()), Optional.of(lIf));
+
updateLInterfaceIps(port, lIf);
if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
updateLInterfaceVlan(port, lIf);
}
- // Update l-interface to the vserver
- transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, cloudRegionId,
- tenantId, port.getDeviceId(), lIf.getInterfaceName()), lIf);
-
updateSriovPfToPserver(port, lIf);
}
}
@@ -360,26 +361,29 @@ public class HeatBridgeImpl implements HeatBridgeApi {
vlan.setInMaint(false);
vlan.setIsIpUnnumbered(false);
vlan.setIsPrivate(false);
- Vlans vlans = new Vlans();
- List<Vlan> vlanList = vlans.getVlan();
- vlanList.add(vlan);
- lIf.setVlans(vlans);
+
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).vlan(vlan.getVlanInterface())),
+ Optional.of(vlan));
}
- // Build sriov-vf to the l-interface
+
if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
- SriovVfs sriovVfs = new SriovVfs();
- // JAXB does not generate setters for list, however getter ensures its creation.
- // Thus, all list manipulations must be made on live list.
- List<SriovVf> sriovVfList = sriovVfs.getSriovVf();
SriovVf sriovVf = new SriovVf();
sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
sriovVf.setNeutronNetworkId(port.getNetworkId());
sriovVf.setVfVlanFilter("0");
sriovVf.setVfVlanAntiSpoofCheck(false);
sriovVf.setVfMacAntiSpoofCheck(false);
- sriovVfList.add(sriovVf);
- lIf.setSriovVfs(sriovVfs);
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).sriovVf(sriovVf.getPciId())),
+ Optional.of(sriovVf));
}
}
@@ -431,13 +435,15 @@ public class HeatBridgeImpl implements HeatBridgeApi {
AAIResourceUri sriovPfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
pserverHostName, matchingPifName.get(), sriovPf.getPfPciId());
- transaction.create(sriovPfUri, sriovPf);
+ if (!resourcesClient.exists(sriovPfUri)) {
+ transaction.create(sriovPfUri, sriovPf);
- AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_VF,
- cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
- port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
+ AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_VF,
+ cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
+ port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
- transaction.connect(sriovPfUri, sriovVfUri);
+ transaction.connect(sriovPfUri, sriovVfUri);
+ }
}
}
} catch (WebApplicationException e) {
@@ -451,7 +457,6 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
private void updateLInterfaceIps(final Port port, final LInterface lIf) {
- List<L3InterfaceIpv4AddressList> lInterfaceIps = lIf.getL3InterfaceIpv4AddressList();
for (IP ip : port.getFixedIps()) {
String ipAddress = ip.getIpAddress();
if (InetAddressValidator.getInstance().isValidInet4Address(ipAddress)) {
@@ -462,7 +467,12 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lInterfaceIp.setNeutronNetworkId(port.getNetworkId());
lInterfaceIp.setNeutronSubnetId(ip.getSubnetId());
lInterfaceIp.setL3InterfaceIpv4PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString()));
- lInterfaceIps.add(lInterfaceIp);
+
+ transaction.createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)),
+ Optional.of(lInterfaceIp));
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 920bb78e8f..643dd4cd9a 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -444,7 +444,7 @@ public class HeatBridgeImplTest {
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(10)).getNetworkById(anyString());
}
@@ -486,7 +486,7 @@ public class HeatBridgeImplTest {
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(transaction, times(5)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(5)).getNetworkById(anyString());
}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
index 20093be6a4..1da6fc096f 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
@@ -52,7 +52,6 @@ import org.onap.appc.client.lcm.model.ZULU;
@Component
public class ApplicationControllerClient {
-
@Autowired
public Environment env;
@@ -117,6 +116,7 @@ public class ApplicationControllerClient {
controllerType = DEFAULT_CONTROLLER_TYPE;
}
controllerType = controllerType.toUpperCase();
+
return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
.createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
} catch (AppcClientException e) {
@@ -128,7 +128,7 @@ public class ApplicationControllerClient {
}
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
- Optional<String> request, String controllerType, ApplicationControllerCallback listener)
+ Optional<String> request, String controllerType, ApplicationControllerCallback listener, String requestorId)
throws ApplicationControllerOrchestratorException {
this.setControllerType(controllerType);
Status status;
@@ -142,7 +142,7 @@ public class ApplicationControllerClient {
payload = new Payload(request.get());
}
- status = runCommand(action, actionIdentifiers, payload, requestId, listener);
+ status = runCommand(action, actionIdentifiers, payload, requestId, listener, requestorId);
if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
@@ -152,11 +152,11 @@ public class ApplicationControllerClient {
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers,
- org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener)
- throws ApplicationControllerOrchestratorException {
+ org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener,
+ String requestorId) throws ApplicationControllerOrchestratorException {
Status status;
Object requestObject;
- requestObject = createRequest(action, actionIdentifiers, payload, requestID);
+ requestObject = createRequest(action, actionIdentifiers, payload, requestID, requestorId);
appCSupport.logLCMMessage(requestObject);
LifeCycleManagerStateful client = getAppCClient();
Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
@@ -194,12 +194,13 @@ public class ApplicationControllerClient {
return properties;
}
- public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
+ public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId,
+ String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
- CommonHeader commonHeader = buildCommonHeader(requestId);
+ CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject,
commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
@@ -215,12 +216,13 @@ public class ApplicationControllerClient {
return requestObject;
}
- private CommonHeader buildCommonHeader(String requestId) {
+ private CommonHeader buildCommonHeader(String requestId, String requestorId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
+ commonHeader.setXOnapRequestorid(requestorId);
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index 8e38935441..e61053d043 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -111,7 +111,7 @@ public class ApplicationControllerTaskImpl {
status = appcClient.vnfCommand(request.getAction(), msoRequestId,
request.getApplicationControllerVnf().getVnfId(), vserverId, payload, request.getControllerType(),
- listener);
+ listener, request.getRequestorId());
return status;
}
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
index 82b0695ed9..cac8e9e16a 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
@@ -63,6 +63,7 @@ public class ApplicationControllerTaskImplITTest {
@Before
public void setup() {
request = new ApplicationControllerTaskRequest();
+ request.setRequestorId("testRequestorId");
request.setBookName("testBookName");
request.setControllerType("testControllerType");
request.setFileParameters("testFileParams");
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index ff979acf7b..fe2b4f84b5 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -52,6 +52,7 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ request.setRequestorId("testRequestorId");
Map<String, String> reqConfigParams = new HashMap<>();
reqConfigParams.put("name1", "value1");
reqConfigParams.put("name2", "value2");
@@ -77,13 +78,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@@ -99,13 +100,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -118,13 +119,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -133,13 +134,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener)).thenReturn(new Status());
+ "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener);
+ "testControllerType", listener, "testRequestorId");
}
@Test
@@ -154,13 +155,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -179,13 +180,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -204,13 +205,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -224,13 +225,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -251,13 +252,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index b337564dab..1f05522011 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -78,6 +78,9 @@ public class AppcOrchestratorPreProcessor {
String identityUrl = execution.getVariable("identityUrl");
appcTaskRequest.setIdentityUrl(identityUrl);
+ String requestorId = gBBInput.getRequestContext().getRequestorId();
+ appcTaskRequest.setRequestorId(requestorId);
+
if (gBBInput.getRequestContext().getRequestParameters() != null) {
String payload = gBBInput.getRequestContext().getRequestParameters().getPayload();
if (payload == null) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index 38c74eecc7..d7d6da209e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -149,6 +149,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
private void fillRequiredAppcExecutionFields() {
RequestContext context = new RequestContext();
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
@@ -192,6 +193,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
"{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
context.setRequestParameters(requestParameters);
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
index 957c603dc9..191e0ac40e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "TEST-CONTROLLER-NAME",
"action": "Lock",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
index 040c680d1c..724f096a4e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "APPC",
"action": "ConfigModify",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
index c240957ae9..010e184618 100644
--- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
+++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
@@ -11,6 +11,7 @@ public class ApplicationControllerTaskRequest implements Serializable {
private static final long serialVersionUID = -3150320542857627682L;
private Action action;
+ private String requestorId;
private String controllerType;
private String identityUrl;
private String operationsTimeout;
@@ -110,6 +111,14 @@ public class ApplicationControllerTaskRequest implements Serializable {
this.newSoftwareVersion = newSoftwareVersion;
}
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
index 1cd23614b5..1f747e6c8c 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
@@ -21,11 +21,13 @@
package org.onap.aaiclient.client.aai;
import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.client.RestClient;
import org.onap.aaiclient.client.graphinventory.GraphInventoryClient;
import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.onap.so.client.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,11 +38,20 @@ public class AAIClient extends GraphInventoryClient {
protected AAIVersion version;
protected AAIClient() {
- super(AAIProperties.class);
+ super(AAIProperties.class, new HashMap<String, String>());
}
protected AAIClient(AAIVersion version) {
- super(AAIProperties.class);
+ super(AAIProperties.class, new HashMap<String, String>());
+ this.version = version;
+ }
+
+ protected AAIClient(Map<String, String> additionalHeaders) {
+ super(AAIProperties.class, additionalHeaders);
+ }
+
+ protected AAIClient(AAIVersion version, Map<String, String> additionalHeaders) {
+ super(AAIProperties.class, additionalHeaders);
this.version = version;
}
@@ -54,7 +65,7 @@ public class AAIClient extends GraphInventoryClient {
protected RestClient createClient(URI uri) {
try {
- return new AAIRestClient(getRestProperties(), constructPath(uri));
+ return new AAIRestClient(getRestProperties(), constructPath(uri), additionalHeaders);
} catch (GraphInventoryUriComputationException | NotFoundException e) {
logger.debug("failed to construct A&AI uri", e);
throw e;
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
index 238e87392f..378db87d9b 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
@@ -26,16 +26,17 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient;
import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+import com.google.common.collect.ImmutableMap;
public class AAIDSLQueryClient
extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> {
public AAIDSLQueryClient() {
- super(new AAIClient());
+ super(new AAIClient(ImmutableMap.of("X-DslApiVersion", "V2")));
}
public AAIDSLQueryClient(AAIVersion version) {
- super(new AAIClient(version));
+ super(new AAIClient(version, ImmutableMap.of("X-DslApiVersion", "V2")));
}
@Override
@@ -53,5 +54,4 @@ public class AAIDSLQueryClient
public AAIObjectType createType(String name, String uri) {
return new AAIFluentTypeReverseLookup().fromName(name, uri);
}
-
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
index 9a8a2a53c0..0f69b0cc8f 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
@@ -23,18 +23,20 @@ package org.onap.aaiclient.client.aai;
import java.net.URI;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.client.ResponseExceptionMapper;
import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.aaiclient.client.graphinventory.GraphInventoryRestClient;
import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.client.ResponseExceptionMapper;
public class AAIRestClient extends GraphInventoryRestClient {
private final AAIProperties aaiProperties;
+ private final Map<String, String> additionalHeaders;
- protected AAIRestClient(AAIProperties props, URI uri) {
+ protected AAIRestClient(AAIProperties props, URI uri, Map<String, String> additionalHeaders) {
super(props, uri);
this.aaiProperties = props;
+ this.additionalHeaders = additionalHeaders;
}
@Override
@@ -46,6 +48,7 @@ public class AAIRestClient extends GraphInventoryRestClient {
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("X-FromAppId", aaiProperties.getSystemName());
headerMap.put("X-TransactionId", requestId);
+ headerMap.putAll(additionalHeaders);
String auth = aaiProperties.getAuth();
String key = aaiProperties.getKey();
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
index a2bb8bc141..f8f977d117 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
@@ -21,20 +21,25 @@
package org.onap.aaiclient.client.graphinventory;
import java.net.URI;
+import java.util.Map;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.RestPropertiesLoader;
-import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
-import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
+import com.google.common.collect.ImmutableMap;
public abstract class GraphInventoryClient {
private RestProperties props;
+ protected final Map<String, String> additionalHeaders;
- protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) {
+ protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass,
+ Map<String, String> additionalHeaders) {
RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass);
this.props = props;
+ this.additionalHeaders = additionalHeaders;
}
protected abstract URI constructPath(URI uri);
@@ -64,4 +69,8 @@ public abstract class GraphInventoryClient {
public abstract GraphInventoryVersion getVersion();
public abstract String getGraphDBName();
+
+ public Map<String, String> getAdditionalHeaders() {
+ return ImmutableMap.copyOf(this.additionalHeaders);
+ }
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
index c749561e5f..a192e3828a 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
@@ -138,4 +138,8 @@ public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInven
}
return clone;
}
+
+ public GraphInventoryClient getClient() {
+ return this.client;
+ }
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
index c071e24391..5c88e8e42e 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
@@ -22,13 +22,17 @@ package org.onap.aaiclient.client.graphinventory.entities;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.stream.Collectors;
import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep {
protected final String nodeName;
+ protected final Collection<String> fields;
protected final List<DSLNodeKey> nodeKeys;
protected final StringBuilder query;
protected boolean output = false;
@@ -37,6 +41,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = "";
this.nodeKeys = new ArrayList<>();
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
}
@@ -44,6 +49,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = name.typeName();
this.nodeKeys = new ArrayList<>();
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
query.append(nodeName);
}
@@ -51,6 +57,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = name.typeName();
this.nodeKeys = Arrays.asList(key);
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
query.append(nodeName);
}
@@ -58,6 +65,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = copy.nodeName;
this.nodeKeys = copy.nodeKeys;
this.query = new StringBuilder(copy.query);
+ this.fields = copy.fields;
this.output = copy.output;
}
@@ -67,6 +75,12 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
return new DSLOutputNode(this);
}
+ public DSLOutputNode output(String... fields) {
+ this.output = true;
+ this.fields.addAll(Arrays.asList(fields));
+ return new DSLOutputNode(this);
+ }
+
public T and(DSLNodeKey... key) {
this.nodeKeys.addAll(Arrays.asList(key));
@@ -77,7 +91,13 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
public String build() {
StringBuilder result = new StringBuilder(query);
if (output) {
- result.append("*");
+ if (fields.isEmpty()) {
+ result.append("*");
+ } else {
+ String items =
+ fields.stream().map(item -> String.format("'%s'", item)).collect(Collectors.joining(", "));
+ result.append("{").append(items).append("}");
+ }
}
for (DSLNodeKey key : nodeKeys) {
result.append(key.build());
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
index 762203258a..59e3895ce2 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
@@ -24,6 +24,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
@@ -49,6 +50,17 @@ public class DSLQueryBuilder<S, E> {
}
public DSLQueryBuilder<S, Node> output() {
+ callOnLambda(item -> item.output());
+ return (DSLQueryBuilder<S, Node>) this;
+ }
+
+ public DSLQueryBuilder<S, Node> output(String... fields) {
+ callOnLambda(item -> item.output(fields));
+ return (DSLQueryBuilder<S, Node>) this;
+ }
+
+ protected void callOnLambda(Consumer<DSLNodeBase> consumer) {
+
Object obj = steps.get(steps.size() - 1);
if (obj instanceof DSLNodeBase) {
((DSLNodeBase) steps.get(steps.size() - 1)).output();
@@ -60,7 +72,7 @@ public class DSLQueryBuilder<S, E> {
try {
o = f.get(obj);
if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) {
- ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output();
+ consumer.accept(((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)));
}
} catch (IllegalArgumentException | IllegalAccessException e) {
}
@@ -68,7 +80,6 @@ public class DSLQueryBuilder<S, E> {
break;
}
}
- return (DSLQueryBuilder<S, Node>) this;
}
@SafeVarargs
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java
new file mode 100644
index 0000000000..36fc1db57c
--- /dev/null
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java
@@ -0,0 +1,17 @@
+package org.onap.aaiclient.client.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.net.URISyntaxException;
+import org.junit.Test;
+
+public class AAIDSLQueryClientTest {
+
+
+
+ @Test
+ public void verifyHeadersTest() throws URISyntaxException {
+
+ AAIDSLQueryClient client = new AAIDSLQueryClient();
+ assertEquals("V2", client.getClient().getAdditionalHeaders().get("X-DslApiVersion"));
+ }
+}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
index 86738beabb..b73454fe67 100644
--- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
@@ -20,6 +20,13 @@
package org.onap.aaiclient.client.aai;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.matching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.hamcrest.CoreMatchers.containsString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -30,6 +37,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashMap;
import javax.ws.rs.core.Response;
import org.junit.Rule;
import org.junit.Test;
@@ -37,10 +45,12 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.RestClientSSL;
+import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import com.google.common.collect.ImmutableMap;
@RunWith(MockitoJUnitRunner.class)
public class AAIRestClientTest {
@@ -53,9 +63,12 @@ public class AAIRestClientTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
@Test
public void failPatchOnComplexObject() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
+ AAIRestClient client = new AAIRestClient(props, new URI(""), new HashMap<String, String>());
this.thrown.expect(GraphInventoryPatchDepthExceededException.class);
this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action"));
client.patch(
@@ -64,7 +77,7 @@ public class AAIRestClientTest {
@Test
public void verifyPatchValidation() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
+ AAIRestClient client = new AAIRestClient(props, new URI(""), new HashMap<String, String>());
AAIRestClient spy = spy(client);
GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class);
doReturn(patchValidatorMock).when(spy).getPatchConverter();
@@ -73,4 +86,14 @@ public class AAIRestClientTest {
spy.patch(payload);
verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object) payload));
}
+
+ @Test
+ public void verifyAdditionalHeadersTest() throws URISyntaxException {
+ AAIRestClient client = new AAIRestClient(new DefaultAAIPropertiesImpl(wireMockRule.port()), new URI("/test"),
+ ImmutableMap.of("test", "value"));
+ wireMockRule.stubFor(get(urlPathEqualTo("/test")).willReturn(aResponse().withStatus(200)));
+ client.get();
+ wireMockRule.verify(getRequestedFor(urlPathEqualTo("/test")).withHeader("X-FromAppId", equalTo("MSO"))
+ .withHeader("X-TransactionId", matching(".*")).withHeader("test", equalTo("value")));
+ }
}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
index 965770c796..9cae761399 100644
--- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
@@ -146,4 +146,15 @@ public class DSLQueryBuilderTest {
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
builder.build().get());
}
+
+ @Test
+ public void selectOutputFilterTest() {
+ DSLQueryBuilder<Output, Output> builder =
+ TraversalBuilder.traversal(new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "att-nc"))
+ .output("cloud-region-id", "a", "b"));
+ builder.to(__.node(AAIObjectType.PSERVER)).output("x", "y", "z");
+
+ assertEquals("cloud-region{'cloud-region-id', 'a', 'b'}('cloud-owner', 'att-nc') > pserver{'x', 'y', 'z'}",
+ builder.build().toString());
+ }
}
diff --git a/pom.xml b/pom.xml
index db097183a1..0243def0ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
<format.skipValidate>false</format.skipValidate>
<format.skipExecute>true</format.skipExecute>
<io.fabric8.version>0.33.0</io.fabric8.version>
- <appc.client.version>1.7.1</appc.client.version>
+ <appc.client.version>1.8.0-SNAPSHOT</appc.client.version>
<bowman.client.version>0.8.0</bowman.client.version>
<aaf.cadi.version>2.1.15</aaf.cadi.version>
</properties>