use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class SouthboundUtils method addAllPortsToBridge.
/*
* Add all tunnels ports corresponding to the bridge to the topology config DS.
*/
public void addAllPortsToBridge(BridgeEntry bridgeEntry, InterfaceManagerCommonUtils interfaceManagerCommonUtils, InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid, OvsdbBridgeAugmentation bridgeNew) {
String bridgeName = bridgeNew.getBridgeName().getValue();
LOG.debug("adding all ports to bridge: {}", bridgeName);
List<BridgeInterfaceEntry> bridgeInterfaceEntries = bridgeEntry.getBridgeInterfaceEntry();
if (bridgeInterfaceEntries != null) {
for (BridgeInterfaceEntry bridgeInterfaceEntry : bridgeInterfaceEntries) {
String portName = bridgeInterfaceEntry.getInterfaceName();
InterfaceKey interfaceKey = new InterfaceKey(portName);
Interface iface = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (iface != null) {
IfTunnel ifTunnel = iface.getAugmentation(IfTunnel.class);
if (ifTunnel != null) {
if (!(interfacemgrProvider.isItmDirectTunnelsEnabled() && ifTunnel.isInternal())) {
addTunnelPortToBridge(ifTunnel, bridgeIid, iface, portName);
}
if (isOfTunnel(ifTunnel)) {
LOG.debug("Using OFTunnel. Only one tunnel port will be added");
return;
}
}
} else {
LOG.debug("Interface {} not found in config DS", portName);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getDpidFromInterface.
@Override
public ListenableFuture<GetDpidFromInterfaceOutput> getDpidFromInterface(GetDpidFromInterfaceInput input) {
String interfaceName = input.getIntfName();
BigInteger dpId;
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface in Config DataStore"));
}
if (Tunnel.class.equals(interfaceInfo.getType())) {
ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
dpId = parentRefs.getDatapathNodeIdentifier();
} else {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
if (ifState != null) {
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
} else {
throw new IllegalArgumentException(getDpidFromInterfaceErrorMessage(interfaceName, "missing Interface-state"));
}
}
return Futures.immediateFuture(new GetDpidFromInterfaceOutputBuilder().setDpid(dpId).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getTunnelType.
@Override
public ListenableFuture<GetTunnelTypeOutput> getTunnelType(GetTunnelTypeInput input) {
String interfaceName = input.getIntfName();
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalArgumentException(String.format("Retrieval of Tunnel Type for the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
}
if (Tunnel.class.equals(interfaceInfo.getType())) {
IfTunnel tnl = interfaceInfo.getAugmentation(IfTunnel.class);
Class<? extends TunnelTypeBase> tunType = tnl.getTunnelInterfaceType();
return Futures.immediateFuture(new GetTunnelTypeOutputBuilder().setTunnelType(tunType).build());
} else {
throw new IllegalArgumentException("Retrieval of interface type failed for key: " + interfaceName);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getInterfaceType.
@Override
public ListenableFuture<GetInterfaceTypeOutput> getInterfaceType(GetInterfaceTypeInput input) {
String interfaceName = input.getIntfName();
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalStateException(String.format("getInterfaceType() Retrieval of Interface Type for " + "the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
}
return Futures.immediateFuture(new GetInterfaceTypeOutputBuilder().setInterfaceType(interfaceInfo.getType()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class TepCommandHelper method buildTeps.
@SuppressWarnings("checkstyle:IllegalCatch")
public void buildTeps() {
TransportZones transportZonesBuilt = null;
TransportZone transportZone = null;
try {
LOG.debug("no of teps added {}", CHECK);
if (transportZonesHashMap != null && !transportZonesHashMap.isEmpty()) {
transportZoneArrayList = new ArrayList<>();
for (Entry<String, Map<SubnetObject, List<Vteps>>> mapEntry : transportZonesHashMap.entrySet()) {
String tz = mapEntry.getKey();
LOG.debug("transportZonesHashMap {}", tz);
subnetList = new ArrayList<>();
Map<SubnetObject, List<Vteps>> subVtepMapTemp = mapEntry.getValue();
for (Entry<SubnetObject, List<Vteps>> entry : subVtepMapTemp.entrySet()) {
SubnetObject subOb = entry.getKey();
LOG.debug("subnets {}", subOb.get_prefix());
List<Vteps> vtepList = entry.getValue();
Subnets subnet = new SubnetsBuilder().setGatewayIp(subOb.get_gatewayIp()).setKey(subOb.get_key()).setPrefix(subOb.get_prefix()).setVlanId(subOb.get_vlanId()).setVteps(vtepList).build();
subnetList.add(subnet);
LOG.debug("vteps {}", vtepList);
}
InstanceIdentifier<TransportZone> transportZonePath = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(tz)).build();
Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, transportZonePath, dataBroker);
LOG.debug("read container from DS");
if (transportZoneOptional.isPresent()) {
TransportZone tzoneFromDs = transportZoneOptional.get();
LOG.debug("read tzone container {}", tzoneFromDs);
if (tzoneFromDs.getTunnelType() == null || tzoneFromDs.getTunnelType().equals(TunnelTypeVxlan.class)) {
transportZone = new TransportZoneBuilder().setKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeVxlan.class).setSubnets(subnetList).setZoneName(tz).build();
} else if (tzoneFromDs.getTunnelType().equals(TunnelTypeGre.class)) {
transportZone = new TransportZoneBuilder().setKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeGre.class).setSubnets(subnetList).setZoneName(tz).build();
}
} else {
transportZone = new TransportZoneBuilder().setKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeVxlan.class).setSubnets(subnetList).setZoneName(tz).build();
}
LOG.debug("tzone object {}", transportZone);
transportZoneArrayList.add(transportZone);
}
transportZonesBuilt = new TransportZonesBuilder().setTransportZone(transportZoneArrayList).build();
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
LOG.debug("InstanceIdentifier {}", path);
ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, transportZonesBuilt, dataBroker, ItmUtils.DEFAULT_CALLBACK);
LOG.debug("wrote to Config DS {}", transportZonesBuilt);
transportZonesHashMap.clear();
transportZoneArrayList.clear();
subnetList.clear();
LOG.debug("Everything cleared");
} else {
LOG.debug("NO vteps were configured");
}
} catch (RuntimeException e) {
LOG.error("Error building TEPs", e);
}
}
Aggregations