use of org.onap.aai.domain.yang.VpnBinding in project so by onap.
the class WorkflowActionExtractResourcesAAITest method extractRelationshipsVpnBinding_notFound_listEmpty.
@Test
public void extractRelationshipsVpnBinding_notFound_listEmpty() {
// given
Relationships relationships = mock(Relationships.class);
when(relationships.getRelatedUris(Types.VPN_BINDING)).thenReturn(Collections.emptyList());
// when
Optional<VpnBinding> resultOpt = testedObject.extractRelationshipsVpnBinding(relationships);
// then
assertThat(resultOpt).isEmpty();
}
use of org.onap.aai.domain.yang.VpnBinding in project so by onap.
the class WorkflowActionExtractResourcesAAITest method extractRelationshipsVpnBinding_noVpnBindingFoundInList.
@Test
public void extractRelationshipsVpnBinding_noVpnBindingFoundInList() {
// given
Relationships relationships = mock(Relationships.class);
AAIResourceUri aaiResourceUri = mock(AAISimpleUri.class);
List<AAIResourceUri> aaiResourceUriList = new ArrayList<>();
aaiResourceUriList.add(aaiResourceUri);
when(relationships.getRelatedUris(Types.VPN_BINDING)).thenReturn(aaiResourceUriList);
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("noJson");
when(bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri)).thenReturn(aaiResultWrapper);
// when
Optional<VpnBinding> resultOpt = testedObject.extractRelationshipsVpnBinding(relationships);
// then
assertThat(resultOpt).isEmpty();
}
use of org.onap.aai.domain.yang.VpnBinding in project so by onap.
the class VrfValidationTest method testAaiRouteTargetValidation.
@Test
public void testAaiRouteTargetValidation() throws VrfBondingServiceException, JsonParseException, JsonMappingException, IOException {
L3Network l3Network = mapper.readValue(new File("src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json"), L3Network.class);
AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network);
if (networkWrapper.getRelationships().isPresent()) {
List<AAIResourceUri> vpnBindingUris = networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
VpnBinding vpnBinding = new VpnBinding();
vpnBinding.setRouteTargets(new RouteTargets());
vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget());
AAIResultWrapper wrapper = Mockito.mock(AAIResultWrapper.class);
doReturn(wrapper).when(bbSetupUtils).getAAIResourceDepthOne(vpnBindingUris.get(0));
doReturn(Optional.of(vpnBinding)).when(wrapper).asBean(VpnBinding.class);
ExpectedException.none();
vrfValidation.aaiRouteTargetValidation(l3Network);
}
}
use of org.onap.aai.domain.yang.VpnBinding in project so by onap.
the class WorkflowActionExtractResourcesAAITest method extractRelationshipsVpnBindingSuccess.
@Test
public void extractRelationshipsVpnBindingSuccess() {
// given
Relationships relationships = mock(Relationships.class);
AAIResourceUri aaiResourceUri = mock(AAISimpleUri.class);
List<AAIResourceUri> aaiResourceUriList = new ArrayList<>();
aaiResourceUriList.add(aaiResourceUri);
when(relationships.getRelatedUris(Types.VPN_BINDING)).thenReturn(aaiResourceUriList);
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("{\"vpn-id\" : \"" + VPN_ID + "\"}");
when(bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri)).thenReturn(aaiResultWrapper);
// when
Optional<VpnBinding> resultOpt = testedObject.extractRelationshipsVpnBinding(relationships);
// then
assertThat(resultOpt).isNotEmpty();
assertThat(resultOpt.get().getVpnId()).isEqualTo(VPN_ID);
}
Aggregations