import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsNot.not;
import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement;
import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofL3Network;
import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofServiceInstance;
import static org.testng.AssertJUnit.assertEquals;
import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.onap.vid.model.aai.AaiResponse;
import org.onap.vid.model.mso.OperationalEnvironmentList;
import org.onap.vid.more.LoggerFormatTest;
+import org.onap.vid.more.LoggerFormatTest.LogName;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), APPEND);
restTemplateErrorAgnostic.getForEntity(uri + "/aai_get_services", String.class);
- String logLines = LoggerFormatTest.getLogLines("error", 15, 0, restTemplate, uri);
+ String logLines = LoggerFormatTest.getLogLines(LogName.error, 15, 0, restTemplate, uri);
assertThat("not found in error log", logLines, containsString("Failed to parse aai response"));
assertThat("not found in error log", logLines, containsString(notAJson));
getResourceAsString("serviceWithNetwork/aaiGetNetworksWithVlansToVnfByServiceInstance.json"),
response);
}
+
@FeatureTogglingTest(value = Features.FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG, flagActive = false)
@Test
public void getVnfDataByGlobalIdAndServiceType() {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
- assertThat(response.getBody(), not(containsString("generic-vfmodule")));
assertResponse(JsonAssert.when(Option.IGNORING_ARRAY_ORDER),
- getResourceAsString("changeManagement/reduced_vnf_data_by_globalid_and_service_type.json"),
+ getResourceAsString("registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_response.json"),
response.getBody());
}
+ @Test
+ public void whenCallAaiThroughAAIRestInterface_thenRequestRecordedInMetricsLog() {
+ registerExpectationFromPresets(ImmutableList.of(
+ new PresetAAIGetVpnsByType(),
+ new PresetAAIGetSubscribersGet()
+ ),CLEAR_THEN_SET);
+
+ String url = uri + "/aai_get_vpn_list";
+ ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
+ final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo");
+ LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId,"/network/vpn-bindings" , 1);
+ }
+
@Test
public void getVpnList() {
SimulatorApi.registerExpectationFromPreset(new PresetAAIGetVpnsByType(), CLEAR_THEN_SET);