@Test public void testResolveDomainLocations() { NodeId nodeId = new NodeId("node1"); TpId tpId = new TpId("tp1"); TopologyId topologyId = new TopologyId("physicalNet"); writeBasicTopology(topologyId, nodeId, tpId); NetworkProviderExtension netExt = new NetworkProviderExtensionBuilder().setPhysicalNetwork("physicalNet") .build(); List<PhysicalLocationRef> resolvedLocations = networkAware.resolveDomainLocations(netExt); PhysicalLocationRef physLocationRef = resolvedLocations.get(0); assertEquals(nodeId, physLocationRef.getNodeId()); assertEquals(tpId.getValue(), physLocationRef.getInterface().get(0)); }
@VisibleForTesting List<PhysicalLocationRef> resolveDomainLocations(NetworkProviderExtension providerAug) { List<PhysicalLocationRef> locationRefs = new ArrayList<>(); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); if (providerAug.getPhysicalNetwork() == null) { return null; } Optional<Topology> readTopology = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, getTopologyIid(new TopologyId(providerAug.getPhysicalNetwork())), rTx); if (readTopology.isPresent()) { Topology topology = readTopology.get(); for (Node node : topology.getNode()) { PhysicalLocationRefBuilder location = new PhysicalLocationRefBuilder(); location.setNodeId(node.getNodeId()); location.setInterface(Lists.transform(node.getTerminationPoint(), new Function<TerminationPoint, String>() { @Override public String apply(TerminationPoint input) { return input.getTpId().getValue(); } })); locationRefs.add(location.build()); } } return locationRefs; }
NetworkAware implements MappingProvider<Network> { @VisibleForTesting List<PhysicalLocationRef> resolveDomainLocations(NetworkProviderExtension providerAug) { List<PhysicalLocationRef> locationRefs = new ArrayList<>(); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); if (providerAug.getPhysicalNetwork() == null) { return null; } Optional<Topology> readTopology = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, getTopologyIid(new TopologyId(providerAug.getPhysicalNetwork())), rTx); if (readTopology.isPresent()) { Topology topology = readTopology.get(); for (Node node : topology.getNode()) { PhysicalLocationRefBuilder location = new PhysicalLocationRefBuilder(); location.setNodeId(node.getNodeId()); location.setInterface(Lists.transform(node.getTerminationPoint(), new Function<TerminationPoint, String>() { @Override public String apply(TerminationPoint input) { return input.getTpId().getValue(); } })); locationRefs.add(location.build()); } } return locationRefs; } }
NetworkAware implements MappingProvider<Network> { @VisibleForTesting List<PhysicalLocationRef> resolveDomainLocations(NetworkProviderExtension providerAug) { List<PhysicalLocationRef> locationRefs = new ArrayList<>(); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); if (providerAug.getPhysicalNetwork() == null) { return null; } Optional<Topology> readTopology = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, getTopologyIid(new TopologyId(providerAug.getPhysicalNetwork())), rTx); if (readTopology.isPresent()) { Topology topology = readTopology.get(); for (Node node : topology.getNode()) { PhysicalLocationRefBuilder location = new PhysicalLocationRefBuilder(); location.setNodeId(node.getNodeId()); location.setInterface(Lists.transform(node.getTerminationPoint(), new Function<TerminationPoint, String>() { @Override public String apply(TerminationPoint input) { return input.getTpId().getValue(); } })); locationRefs.add(location.build()); } } return locationRefs; } NetworkAware(DataBroker dataBroker); }
NetworkAware implements MappingProvider<Network> { @VisibleForTesting List<PhysicalLocationRef> resolveDomainLocations(NetworkProviderExtension providerAug) { List<PhysicalLocationRef> locationRefs = new ArrayList<>(); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); if (providerAug.getPhysicalNetwork() == null) { return null; } Optional<Topology> readTopology = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, getTopologyIid(new TopologyId(providerAug.getPhysicalNetwork())), rTx); if (readTopology.isPresent()) { Topology topology = readTopology.get(); for (Node node : topology.getNode()) { PhysicalLocationRefBuilder location = new PhysicalLocationRefBuilder(); location.setNodeId(node.getNodeId()); location.setInterface(Lists.transform(node.getTerminationPoint(), new Function<TerminationPoint, String>() { @Override public String apply(TerminationPoint input) { return input.getTpId().getValue(); } })); locationRefs.add(location.build()); } } return locationRefs; } NetworkAware(DataBroker dataBroker); @Override InstanceIdentifier<Network> getNeutronDtoIid(); @Override void processCreatedNeutronDto(Network network); static Class<? extends NetworkTypeBase> convertNetworkType(
            Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeBase> base); @Override void processUpdatedNeutronDto(Network originalNetwork, Network updatedNetwork); @Override void processDeletedNeutronDto(Network network); }
NetworkAware implements MappingProvider<Network> { @VisibleForTesting List<PhysicalLocationRef> resolveDomainLocations(NetworkProviderExtension providerAug) { List<PhysicalLocationRef> locationRefs = new ArrayList<>(); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); if (providerAug.getPhysicalNetwork() == null) { return null; } Optional<Topology> readTopology = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, getTopologyIid(new TopologyId(providerAug.getPhysicalNetwork())), rTx); if (readTopology.isPresent()) { Topology topology = readTopology.get(); for (Node node : topology.getNode()) { PhysicalLocationRefBuilder location = new PhysicalLocationRefBuilder(); location.setNodeId(node.getNodeId()); location.setInterface(Lists.transform(node.getTerminationPoint(), new Function<TerminationPoint, String>() { @Override public String apply(TerminationPoint input) { return input.getTpId().getValue(); } })); locationRefs.add(location.build()); } } return locationRefs; } NetworkAware(DataBroker dataBroker); @Override InstanceIdentifier<Network> getNeutronDtoIid(); @Override void processCreatedNeutronDto(Network network); static Class<? extends NetworkTypeBase> convertNetworkType(
            Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeBase> base); @Override void processUpdatedNeutronDto(Network originalNetwork, Network updatedNetwork); @Override void processDeletedNeutronDto(Network network);  }