use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase in project genius by opendaylight.
the class ItmUtils method getExtTunnel.
private static String getExtTunnel(String nodeId, String dpId, Class<? extends TunnelTypeBase> tunType, DataBroker dataBroker) {
LOG.trace("getting ext tunnel for {} and dpId {}", nodeId, dpId);
ExternalTunnelKey key = getExternalTunnelKey(dpId, nodeId, tunType);
InstanceIdentifier<ExternalTunnel> intIID = InstanceIdentifier.builder(ExternalTunnelList.class).child(ExternalTunnel.class, key).build();
Optional<ExternalTunnel> tunnelsOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, intIID, dataBroker);
if (tunnelsOptional.isPresent()) {
String tunnelInterfaceName = tunnelsOptional.get().getTunnelInterfaceName();
LOG.trace("ext tunnel returned {} ", tunnelInterfaceName);
return tunnelInterfaceName;
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase in project genius by opendaylight.
the class ItmTunnelAggregationHelper method initTunnelAggregationConfig.
private void initTunnelAggregationConfig(ItmConfig itmConfig) {
// Load balancing of VxLAN feature is guarded by a global configuration option in the ITM,
// only when the feature is enabled, the logical tunnel interfaces should be created.
boolean tunnelAggregationConfigEnabled = false;
List<TunnelAggregation> tunnelsConfig = itmConfig != null ? itmConfig.getTunnelAggregation() : null;
if (tunnelsConfig != null) {
for (TunnelAggregation tnlCfg : tunnelsConfig) {
Class<? extends TunnelTypeBase> tunType = ItmUtils.getTunnelType(tnlCfg.getKey().getTunnelType());
if (tunType.isAssignableFrom(TunnelTypeVxlan.class)) {
tunnelAggregationConfigEnabled = tnlCfg.isEnabled();
LOG.info("MULTIPLE_VxLAN_TUNNELS: tunnelAggregationEnabled {}", tunnelAggregationConfigEnabled);
break;
}
}
}
tunnelAggregationEnabled = tunnelAggregationConfigEnabled;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase in project genius by opendaylight.
the class TransportZoneListener method createDPNTepInfoFromNotHosted.
private List<DPNTEPsInfo> createDPNTepInfoFromNotHosted(TransportZone tzNew) {
Map<BigInteger, List<TunnelEndPoints>> mapNotHostedDPNToTunnelEndpt = new ConcurrentHashMap<>();
List<DPNTEPsInfo> notHostedDpnTepInfo = new ArrayList<>();
String newZoneName = tzNew.getZoneName();
List<TzMembership> zones = ItmUtils.createTransportZoneMembership(newZoneName);
Class<? extends TunnelTypeBase> tunnelType = tzNew.getTunnelType();
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = getNotHostedTransportZone(newZoneName).get();
if (tepsInNotHostedTransportZone == null) {
return notHostedDpnTepInfo;
}
List<UnknownVteps> unVtepsLst = tepsInNotHostedTransportZone.getUnknownVteps();
List<Vteps> vtepsList = new ArrayList<>();
if (unVtepsLst != null && !unVtepsLst.isEmpty()) {
for (UnknownVteps vteps : unVtepsLst) {
BigInteger dpnID = vteps.getDpnId();
String port = ITMConstants.DUMMY_PORT;
int vlanID = ITMConstants.DUMMY_VLANID;
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(ITMConstants.DUMMY_PREFIX);
IpAddress gatewayIP = IpAddressBuilder.getDefaultInstance(ITMConstants.DUMMY_GATEWAY_IP);
IpAddress ipAddress = vteps.getIpAddress();
boolean useOfTunnel = ItmUtils.falseIfNull(vteps.isOfTunnel());
String tos = vteps.getOptionTunnelTos();
if (tos == null) {
tos = itmConfig.getDefaultTunnelTos();
}
TunnelEndPoints tunnelEndPoints = ItmUtils.createTunnelEndPoints(dpnID, ipAddress, port, useOfTunnel, vlanID, ipPrefix, gatewayIP, zones, tunnelType, tos);
List<TunnelEndPoints> tunnelEndPointsList = mapNotHostedDPNToTunnelEndpt.get(dpnID);
if (tunnelEndPointsList != null) {
tunnelEndPointsList.add(tunnelEndPoints);
} else {
tunnelEndPointsList = new ArrayList<>();
tunnelEndPointsList.add(tunnelEndPoints);
mapNotHostedDPNToTunnelEndpt.put(dpnID, tunnelEndPointsList);
}
Vteps newVtep = createVtepFromUnKnownVteps(dpnID, ipAddress, ITMConstants.DUMMY_PORT);
vtepsList.add(newVtep);
// Enqueue 'remove TEP from TepsNotHosted list' operation
// into DataStoreJobCoordinator
ItmTepsNotHostedRemoveWorker removeWorker = new ItmTepsNotHostedRemoveWorker(newZoneName, ipAddress, dpnID, dataBroker);
jobCoordinator.enqueueJob(newZoneName, removeWorker);
}
}
// Enqueue 'add TEP received from southbound OVSDB into ITM config DS' operation
// into DataStoreJobCoordinator
ItmTepsNotHostedMoveWorker moveWorker = new ItmTepsNotHostedMoveWorker(vtepsList, newZoneName, dataBroker);
jobCoordinator.enqueueJob(newZoneName, moveWorker);
if (mapNotHostedDPNToTunnelEndpt.size() > 0) {
for (Entry<BigInteger, List<TunnelEndPoints>> entry : mapNotHostedDPNToTunnelEndpt.entrySet()) {
DPNTEPsInfo newDpnTepsInfo = ItmUtils.createDPNTepInfo(entry.getKey(), entry.getValue());
notHostedDpnTepInfo.add(newDpnTepsInfo);
}
}
return notHostedDpnTepInfo;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase in project genius by opendaylight.
the class TransportZoneListener method createhWVteps.
private List<HwVtep> createhWVteps(TransportZone transportZone) {
List<HwVtep> hwVtepsList = new ArrayList<>();
String zoneName = transportZone.getZoneName();
Class<? extends TunnelTypeBase> tunnelType = transportZone.getTunnelType();
LOG.trace("Transport Zone_name: {}", zoneName);
List<Subnets> subnetsList = transportZone.getSubnets();
if (subnetsList != null) {
for (Subnets subnet : subnetsList) {
IpPrefix ipPrefix = subnet.getPrefix();
IpAddress gatewayIP = subnet.getGatewayIp();
int vlanID = subnet.getVlanId();
LOG.trace("IpPrefix: {}, gatewayIP: {}, vlanID: {} ", ipPrefix, gatewayIP, vlanID);
List<DeviceVteps> deviceVtepsList = subnet.getDeviceVteps();
if (deviceVtepsList != null) {
for (DeviceVteps vteps : deviceVtepsList) {
String topologyId = vteps.getTopologyId();
String nodeId = vteps.getNodeId();
IpAddress ipAddress = vteps.getIpAddress();
LOG.trace("topo-id: {}, node-id: {}, ipAddress: {}", topologyId, nodeId, ipAddress);
HwVtep hwVtep = ItmUtils.createHwVtepObject(topologyId, nodeId, ipAddress, ipPrefix, gatewayIP, vlanID, tunnelType, transportZone);
LOG.trace("Adding new HwVtep {} info ", hwVtep.getHwIp());
hwVtepsList.add(hwVtep);
}
}
}
}
LOG.trace("returning hwvteplist {}", hwVtepsList);
return hwVtepsList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase in project genius by opendaylight.
the class AddExternalEndpoint method doExecute.
@SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:RegexpSinglelineJava" })
@Override
protected Object doExecute() {
try {
LOG.debug("AddExternalEndpoint: destinationIP {} with tunnelType {}", destinationIp, tunnelType);
Class<? extends TunnelTypeBase> tunType;
if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_VXLAN)) {
tunType = TunnelTypeVxlan.class;
} else if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_GRE)) {
tunType = TunnelTypeGre.class;
} else if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_MPLSoGRE)) {
tunType = TunnelTypeMplsOverGre.class;
} else {
System.out.println("Invalid tunnel-type " + tunnelType);
return null;
}
if (!itmProvider.validateIP(destinationIp)) {
System.out.println("Invalid IpAddress " + destinationIp);
return null;
}
IpAddress dcgwIPAddr = IpAddressBuilder.getDefaultInstance(destinationIp);
itmProvider.addExternalEndpoint(tunType, dcgwIPAddr);
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
LOG.error("Exception occurred during execution of command \"tep:configure-tunnelType\": ", e);
}
return null;
}
Aggregations