use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class TepCommandHelper method createLocalCache.
@SuppressWarnings("checkstyle:IllegalCatch")
public void createLocalCache(Uint64 dpnId, String ipAddress, String transportZone) throws TepException {
CHECK.incrementAndGet();
IpAddress ipAddressObj;
final VtepsKey vtepkey = new VtepsKey(dpnId);
ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress);
if (checkTepPerTzPerDpn(transportZone, dpnId)) {
handleError("Only one end point per transport Zone per Dpn is allowed");
return;
}
Vteps vtepCli = new VtepsBuilder().setDpnId(dpnId).setIpAddress(ipAddressObj).withKey(vtepkey).build();
if (transportZonesHashMap.containsKey(transportZone)) {
List<Vteps> vtepListTemp = transportZonesHashMap.get(transportZone);
if (!vtepListTemp.contains(vtepCli)) {
vtepListTemp.add(vtepCli);
}
} else {
List<Vteps> vtepListTemp = new ArrayList<>();
vtepListTemp.add(vtepCli);
transportZonesHashMap.put(transportZone, vtepListTemp);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class ItmInternalTunnelAddWorker method wireUpWithinTransportZone.
private void wireUpWithinTransportZone(TypedReadWriteTransaction<Configuration> tx, DPNTEPsInfo srcDpn, DPNTEPsInfo dstDpn, IMdsalApiManager mdsalManager) throws ExecutionException, InterruptedException, OperationFailedException {
LOG.trace("Wiring up within Transport Zone for Dpns {}, {} ", srcDpn, dstDpn);
List<TunnelEndPoints> srcEndPts = srcDpn.nonnullTunnelEndPoints();
List<TunnelEndPoints> dstEndPts = dstDpn.nonnullTunnelEndPoints();
for (TunnelEndPoints srcte : srcEndPts) {
for (TunnelEndPoints dstte : dstEndPts) {
// Compare the Transport zones
if (!Objects.equals(srcDpn.getDPNID(), dstDpn.getDPNID())) {
if (!ItmUtils.getIntersection(srcte.nonnullTzMembership(), dstte.nonnullTzMembership()).isEmpty()) {
// wire them up
wireUpBidirectionalTunnel(tx, srcte, dstte, srcDpn.getDPNID(), dstDpn.getDPNID(), mdsalManager);
if (!ItmTunnelAggregationHelper.isTunnelAggregationEnabled()) {
// CHECK THIS -- Assumption -- One end point per Dpn per transport zone
break;
}
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class ItmUtils method getTransportZoneOfVtep.
/**
* Returns the transport zone of vtep from Configuration datastore.
*
* @param dpid datapath id of vtep
* @param dataBroker data broker handle to perform operations on datastore
* @return the TransportZone object in Config DS
*/
public static TransportZone getTransportZoneOfVtep(Uint64 dpid, DataBroker dataBroker) {
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
if (transportZonesOptional.isPresent()) {
TransportZones tzones = transportZonesOptional.get();
for (TransportZone tzone : tzones.getTransportZone()) {
List<Vteps> vtepList = new ArrayList<>(tzone.nonnullVteps().values());
if (vtepList != null && !vtepList.isEmpty()) {
for (Vteps vtep : vtepList) {
if (vtep.getDpnId().equals(dpid)) {
return tzone;
}
}
}
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class TransportZoneListener method createDPNTepInfo.
private List<DPNTEPsInfo> createDPNTepInfo(TransportZone transportZone) {
Map<Uint64, List<TunnelEndPoints>> mapDPNToTunnelEndpt = new ConcurrentHashMap<>();
List<DPNTEPsInfo> dpnTepInfo = new ArrayList<>();
List<TzMembership> zones = ItmUtils.createTransportZoneMembership(transportZone.getZoneName());
Class<? extends TunnelTypeBase> tunnelType = transportZone.getTunnelType();
LOG.trace("Transport Zone_name: {}", transportZone.getZoneName());
@Nullable Map<VtepsKey, Vteps> vtepsList = transportZone.getVteps();
String portName = itmConfig.getPortname() == null ? ITMConstants.DUMMY_PORT : itmConfig.getPortname();
int vlanId = itmConfig.getVlanId() != null ? itmConfig.getVlanId().toJava() : ITMConstants.DUMMY_VLANID;
if (vtepsList != null && !vtepsList.isEmpty()) {
for (Vteps vteps : vtepsList.values()) {
Uint64 dpnID = vteps.getDpnId();
IpAddress ipAddress = vteps.getIpAddress();
boolean useOfTunnel = itmConfig.isUseOfTunnels();
String tos = vteps.getOptionTunnelTos();
if (tos == null) {
tos = itmConfig.getDefaultTunnelTos();
}
LOG.trace("DpnID: {}, ipAddress: {}", dpnID, ipAddress);
TunnelEndPoints tunnelEndPoints = ItmUtils.createTunnelEndPoints(dpnID, ipAddress, portName, useOfTunnel, vlanId, zones, tunnelType, tos);
EVENT_LOGGER.debug("ITM-createDPNTepInfo for {} {}", dpnID, ipAddress);
List<TunnelEndPoints> tunnelEndPointsList = mapDPNToTunnelEndpt.get(dpnID);
if (tunnelEndPointsList != null) {
LOG.trace("Existing DPN info list in the Map: {} ", dpnID);
tunnelEndPointsList.add(tunnelEndPoints);
} else {
LOG.trace("Adding new DPN info list to the Map: {} ", dpnID);
tunnelEndPointsList = new ArrayList<>();
tunnelEndPointsList.add(tunnelEndPoints);
mapDPNToTunnelEndpt.put(dpnID, tunnelEndPointsList);
}
}
}
if (!mapDPNToTunnelEndpt.isEmpty()) {
LOG.trace("List of dpns in the Map: {} ", mapDPNToTunnelEndpt.keySet());
for (Entry<Uint64, List<TunnelEndPoints>> entry : mapDPNToTunnelEndpt.entrySet()) {
DPNTEPsInfo newDpnTepsInfo = ItmUtils.createDPNTepInfo(entry.getKey(), entry.getValue());
dpnTepInfo.add(newDpnTepsInfo);
}
}
return dpnTepInfo;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class OvsdbTepAddConfigHelper method addUnknownTzTepIntoTepsNotHosted.
/**
* Adds the TEP into Vtep list in the subnet list in the transport zone list
* from ITM operational Datastore by merge operation with write transaction.
*
* @param tzName transport zone name in string
* @param tepIpAddress TEP IP address in IpAddress object
* @param dpid bridge datapath ID
* @param ofTunnel boolean flag for TEP to enable/disable of-tunnel feature on it
* @param dataBroker data broker handle to perform operations on operational datastore
* @param tx TypedWriteTransaction object
*/
protected static void addUnknownTzTepIntoTepsNotHosted(String tzName, IpAddress tepIpAddress, Uint64 dpid, boolean ofTunnel, DataBroker dataBroker, TypedWriteTransaction<Datastore.Operational> tx) {
Map<UnknownVtepsKey, UnknownVteps> vtepList;
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = ItmUtils.getUnknownTransportZoneFromITMOperDS(tzName, dataBroker);
if (tepsInNotHostedTransportZone == null) {
LOG.trace("Unhosted TransportZone ({}) does not exist in OperDS.", tzName);
vtepList = new HashMap<>();
addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
} else {
vtepList = tepsInNotHostedTransportZone.getUnknownVteps();
if (vtepList == null || vtepList.isEmpty()) {
// case: vtep list does not exist or it has no elements
if (vtepList == null) {
LOG.trace("Add TEP into unhosted TZ ({}) when no vtep-list in the TZ.", tzName);
vtepList = new HashMap<>();
}
LOG.trace("Add TEP into unhosted TZ ({}) when no vtep-list in the TZ.", tzName);
addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
} else {
// case: vtep list has elements
boolean vtepFound = false;
UnknownVteps oldVtep = null;
for (UnknownVteps vtep : vtepList.values()) {
if (Objects.equals(vtep.getDpnId(), dpid)) {
vtepFound = true;
oldVtep = vtep;
break;
}
}
if (!vtepFound) {
addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
} else {
// vtep is found, update it with tep-ip
vtepList.remove(oldVtep.key());
addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
}
}
}
}
Aggregations