use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.DesignatedSwitchesForExternalTunnels in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method initilizeCaches.
private void initilizeCaches() {
LOG.trace("Loading designatedDpnsToTunnelIpElanNameCache");
InstanceIdentifier<DesignatedSwitchesForExternalTunnels> instanceIdentifier = InstanceIdentifier.builder(DesignatedSwitchesForExternalTunnels.class).build();
Optional<DesignatedSwitchesForExternalTunnels> designatedSwitchForTunnelOptional = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
if (designatedSwitchForTunnelOptional.isPresent()) {
List<DesignatedSwitchForTunnel> list = designatedSwitchForTunnelOptional.get().getDesignatedSwitchForTunnel();
for (DesignatedSwitchForTunnel designatedSwitchForTunnel : list) {
Set<Pair<IpAddress, String>> setOfTunnelIpElanNamePair = designatedDpnsToTunnelIpElanNameCache.get(BigInteger.valueOf(designatedSwitchForTunnel.getDpId()));
if (setOfTunnelIpElanNamePair == null) {
setOfTunnelIpElanNamePair = new CopyOnWriteArraySet<>();
}
Pair<IpAddress, String> tunnelIpElanNamePair = new ImmutablePair<>(designatedSwitchForTunnel.getTunnelRemoteIpAddress(), designatedSwitchForTunnel.getElanInstanceName());
setOfTunnelIpElanNamePair.add(tunnelIpElanNamePair);
designatedDpnsToTunnelIpElanNameCache.put(BigInteger.valueOf(designatedSwitchForTunnel.getDpId()), setOfTunnelIpElanNamePair);
}
}
LOG.trace("Loading vniMacAddressToPortCache");
InstanceIdentifier<Ports> inst = InstanceIdentifier.builder(Neutron.class).child(Ports.class).build();
Optional<Ports> optionalPorts = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, inst);
if (optionalPorts.isPresent()) {
List<Port> list = optionalPorts.get().getPort();
for (Port port : list) {
if (NeutronUtils.isPortVnicTypeNormal(port)) {
continue;
}
String macAddress = port.getMacAddress().getValue();
Uuid networkId = port.getNetworkId();
String segmentationId = DhcpServiceUtils.getSegmentationId(networkId, broker);
if (segmentationId == null) {
return;
}
updateVniMacToPortCache(new BigInteger(segmentationId), macAddress, port);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.DesignatedSwitchesForExternalTunnels in project netvirt by opendaylight.
the class DhcpExternalTunnelManager method isDpnDesignatedDpn.
private boolean isDpnDesignatedDpn(BigInteger dpId) {
InstanceIdentifier<DesignatedSwitchesForExternalTunnels> instanceIdentifier = InstanceIdentifier.builder(DesignatedSwitchesForExternalTunnels.class).build();
Optional<DesignatedSwitchesForExternalTunnels> designatedSwitchForTunnelOptional = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
if (designatedSwitchForTunnelOptional.isPresent()) {
List<DesignatedSwitchForTunnel> list = designatedSwitchForTunnelOptional.get().getDesignatedSwitchForTunnel();
for (DesignatedSwitchForTunnel designatedSwitchForTunnel : list) {
if (dpId.equals(BigInteger.valueOf(designatedSwitchForTunnel.getDpId()))) {
return true;
}
}
}
return false;
}
Aggregations