public TransportZoneBuilder(TransportZone base) { if (base.getKey() == null) { this._key = new TransportZoneKey( base.getZoneName() ); this._zoneName = base.getZoneName(); } else { this._key = base.getKey(); this._zoneName = _key.getZoneName(); } this._subnets = base.getSubnets(); this._tunnelType = base.getTunnelType(); if (base instanceof TransportZoneImpl) { TransportZoneImpl impl = (TransportZoneImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if( (!tZoneFromConfigDS.getTunnelType().equals(tunType)) && ItmUtils.isNotEmpty(tZoneFromConfigDS.getSubnets())) { String errorMsg = new StringBuilder("Changing the tunnel type from ").append(tZoneFromConfigDS.getTunnelType()) .append(" to ").append(strTunnelType) .append(" is not allowed for already configured transport zone [").append(tZoneName)
String zone_name = transportZone.getZoneName(); Class<? extends TunnelTypeBase> tunnel_type = transportZone.getTunnelType(); LOG.trace("Transport Zone_name: {}", zone_name); List<Subnets> subnetsList = transportZone.getSubnets(); if(subnetsList!=null){ for (Subnets subnet : subnetsList) {
@Override public String toString() { return "AddL2GwDevicesToTransportZoneJob [transportZone=" + transportZone.getZoneName() + "]"; } }
return result; String transportZone = tZones.getTransportZone().get(0).getZoneName(); if (tZones.getTransportZone().get(0).getSubnets() == null || tZones.getTransportZone().get(0).getSubnets().isEmpty()) { result.set(RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, "No subnets Configured").build()); return result; SubnetsKey subnetsKey = tZones.getTransportZone().get(0).getSubnets().get(0).getKey(); DeviceVtepsKey deviceVtepKey = new DeviceVtepsKey(hwIp, node_id.get(0)); InstanceIdentifier<DeviceVteps> path =
TransportZones tZones = tZonesOptional.get(); for (TransportZone tZ : tZones.getTransportZone()) { if (tZ.getSubnets() == null || tZ.getSubnets().isEmpty()) continue; for (Subnets sub : tZ.getSubnets()) { vtepDelList.addAll(vtepDelCommitList); for (Vteps vtep : vtepDelList) { (InstanceIdentifier<T>) InstanceIdentifier .builder(TransportZones.class) .child(TransportZone.class, tZ.getKey()) .child(Subnets.class, sub.getKey()) .child(Vteps.class, vtep.getKey()).build(); if (tZ.getSubnets() == null || tZ.getSubnets().isEmpty()) continue; for (Subnets sub : subDelList) { if (tZ.getSubnets().remove(sub)) { InstanceIdentifier<T> spath = (InstanceIdentifier<T>) InstanceIdentifier .builder(TransportZones.class) .child(TransportZone.class, tZ.getKey()) .child(Subnets.class, sub.getKey()).build(); subnetPaths.add(spath); if (tZ.getSubnets() == null || tZ.getSubnets().size() == 0) { tzDelList.add(tZ); InstanceIdentifier<T> tpath = (InstanceIdentifier<T>) InstanceIdentifier.builder(TransportZones.class)
/** * Checks if is gre tunnel type. * * @param tZoneName * the zone name * @param tZoneMap * the zone map * @return true, if is gre tunnel type */ private boolean isGreTunnelType(String tZoneName, Map<String, TransportZone> tZoneMap) { TransportZone tzone = tZoneMap.get(tZoneName); /* if (tzone != null && StringUtils.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_GRE, tzone.getTunnelType())) { return true; } */ if( (tzone != null) && (tzone.getTunnelType()).equals(TunnelTypeGre.class) ) { return true; } return false; }
if (tZoneOptional.isPresent()) { TransportZone tz = tZoneOptional.get(); if (tz.getSubnets() == null || tz.getSubnets().isEmpty()) return false; for (Subnets sub : tz.getSubnets()) { if (sub.getVteps() == null || sub.getVteps().isEmpty()) continue;
String zone_name = transportZone.getZoneName(); Class<? extends TunnelTypeBase> tunnel_type = transportZone.getTunnelType(); LOG.trace("Transport Zone_name: {}", zone_name); List<Subnets> subnetsList = transportZone.getSubnets(); if (subnetsList != null) { for (Subnets subnet : subnetsList) {
if (tZ.getTunnelType().equals(TunnelTypeGre.class)) { isGreType = true; for (Subnets sub : ItmUtils.emptyIfNull(tZ.getSubnets())) { List<Vteps> vtepList = sub.getVteps(); validateForDuplicateAndSingleGreTep(inputVtep, isConfiguredTepGreType, isGreType, vtepList);
/** * Gets the job key. * * @return the job key */ public String getJobKey() { return "L2GW" + this.transportZone.getZoneName(); }
return result; String transportZone = tZones.getTransportZone().get(0).getZoneName(); if (tZones.getTransportZone().get(0).getSubnets() == null || tZones.getTransportZone().get(0).getSubnets().isEmpty()) { result.set(RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, "No subnets Configured").build()); return result; SubnetsKey subnetsKey = tZones.getTransportZone().get(0).getSubnets().get(0).getKey(); DeviceVtepsKey deviceVtepKey = new DeviceVtepsKey(hwIp, node_id.get(0)); InstanceIdentifier<DeviceVteps> path =
@Override protected void add(InstanceIdentifier<TransportZone> key, TransportZone tzNew) { if (LOG.isTraceEnabled()) { LOG.trace("Received Transport Zone Add Event: {}", tzNew); } if (tzNew.getTunnelType().equals(TunnelTypeVxlan.class)) { DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance(); AddL2GwDevicesToTransportZoneJob job = new AddL2GwDevicesToTransportZoneJob(dataBroker, itmRpcService, tzNew); coordinator.enqueueJob(job.getJobKey(), job); } }
private int addVtep(TransportZone zone, String subnetIp, BigInteger dpnId) throws Exception { Subnets subnets = findSubnets(zone.getSubnets(), subnetIp); for(Vteps existingVtep : subnets.getVteps()){ if (existingVtep.getDpnId().equals(dpnId)) { return 0; } } IpAddress nodeIp = getNodeIP(dpnId); VtepsBuilder vtepsBuilder = new VtepsBuilder(); vtepsBuilder.setDpnId(dpnId); vtepsBuilder.setIpAddress(nodeIp); vtepsBuilder.setPortname(TUNNEL_PORT); subnets.getVteps().add(vtepsBuilder.build()); return 1; }
result.add("------------------------------------------------------------------------------------------------------------------------------"); for (TransportZone tZ : tZones.getTransportZone()) { if (tZ.getSubnets() == null || tZ.getSubnets().isEmpty()) { LOG.error("Transport Zone " + tZ.getZoneName() + "has no subnets"); continue; for (Subnets sub : tZ.getSubnets()) { if (sub.getVteps() == null || sub.getVteps().isEmpty()) { LOG.error("Transport Zone " + tZ.getZoneName() + "subnet " + sub.getPrefix() + "has no vteps"); continue; flag = true; String strTunnelType ; if( (tZ.getTunnelType()).equals(TunnelTypeGre.class) ) strTunnelType = ITMConstants.TUNNEL_TYPE_GRE ; else strTunnelType = ITMConstants.TUNNEL_TYPE_VXLAN ; result.add(String.format("%-16s %-16s %-16s %-12s %-12s %-12s %-16s %-12s", tZ.getZoneName(), strTunnelType, sub .getPrefix().getIpv4Prefix().getValue(), sub.getGatewayIp().getIpv4Address() .getValue(), sub.getVlanId().toString(), vtep.getDpnId().toString(), vtep
if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_subnets, other.getSubnets())) { return false; if (!Objects.equals(_tunnelType, other.getTunnelType())) { return false; if (!Objects.equals(_zoneName, other.getZoneName())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
Optional<TransportZone> tZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker); if (tZoneOptional.isPresent()) { if (tZoneOptional.get().getSubnets() != null && !tZoneOptional.get().getSubnets().isEmpty()) { for (Subnets sub : tZoneOptional.get().getSubnets()) { if (sub.getVteps() != null && !sub.getVteps().isEmpty()) { for (Vteps vtepLocal : sub.getVteps()) { for (Vteps vtepRemote : sub.getVteps()) { if (!vtepLocal.equals(vtepRemote)) { InternalTunnelKey key = new InternalTunnelKey(vtepRemote.getDpnId(), vtepLocal.getDpnId(), tZoneOptional.get().getTunnelType()); InstanceIdentifier<InternalTunnel> intIID = InstanceIdentifier.builder(TunnelList.class).
/** * Instantiates a new adds the l2 gw devices to transport zone job. * * @param dataBroker the data broker * @param itmRpcService the itm rpc service * @param transportZone the transport zone */ public AddL2GwDevicesToTransportZoneJob(DataBroker dataBroker, ItmRpcService itmRpcService, TransportZone transportZone) { this.dataBroker = dataBroker; this.itmRpcService = itmRpcService; this.transportZone = transportZone; LOG.debug("created AddL2GwDevicesToTransportZone Job for tZone {}", transportZone.getZoneName()); }
TransportZone tzoneFromDs = tZoneOptional.get(); LOG.debug("read tzone container" + tzoneFromDs.toString()); if (tzoneFromDs.getTunnelType() == null || (tzoneFromDs.getTunnelType()).equals(TunnelTypeVxlan.class)) { tZone = new TransportZoneBuilder().setKey(new TransportZoneKey(tZ)) .setTunnelType(TunnelTypeVxlan.class).setSubnets(subnetList) .setZoneName(tZ).build(); } else if ((tzoneFromDs.getTunnelType()).equals(TunnelTypeGre.class)) { tZone = new TransportZoneBuilder().setKey(new TransportZoneKey(tZ))
TransportZone tZone = tZoneOptional.get(); if (tZone.getSubnets() != null && !tZone.getSubnets().isEmpty()) { for (Subnets sub : tZone.getSubnets()) { if (sub.getDeviceVteps() != null && !sub.getDeviceVteps().isEmpty()) { for (DeviceVteps hwVtepDS : sub.getDeviceVteps()) {