import java.util.Map;
import java.util.Map.Entry;
-import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
@Override
public void execute() {
for (final Entry<InstanceIdentifier<?>, DataObject> updated : changes.entrySet()) {
- if (updated.getValue() != null && updated.getValue() instanceof EvcAugmentation) {
+ if ((updated.getValue() != null) && (updated.getValue() instanceof EvcAugmentation)) {
final EvcAugmentation evc = (EvcAugmentation) updated.getValue();
final InstanceIdentifier<?> evcKey = updated.getKey();
// FIXME: For now, we assume that there is 1 uni per
// source/destination
- if (evc.getUniDest() == null || evc.getUniDest().isEmpty()) {
+ if ((evc.getUniDest() == null) || evc.getUniDest().isEmpty()) {
LOG.error("Destination UNI cannot be null.");
break;
}
- if (evc.getUniSource() == null || evc.getUniSource().isEmpty()) {
+ if ((evc.getUniSource() == null) || evc.getUniSource().isEmpty()) {
LOG.error("Source UNI cannot be null.");
break;
}
final Optional<Node> optionalDestinationBr = UnimgrUtils.readNode(dataBroker,
LogicalDatastoreType.OPERATIONAL,
destinationBridgeIid);
+ //update ovsdb qos-entry and queues with max-rate to match evc ingress BW
+ UnimgrUtils.updateMaxRate(dataBroker, sourceUniAugmentation, destinationUniAugmentation, evc);
Node sourceBr = null;
Node destinationBr = null;
if (optionalSourceBr.isPresent() && optionalDestinationBr.isPresent()) {
*/
public static OvsdbBridgeAugmentation createOvsdbBridgeAugmentation(Uni uni) throws Exception {
final OvsdbNodeRef ovsdbNodeRef = uni.getOvsdbNodeRef();
- if (ovsdbNodeRef != null && ovsdbNodeRef.getValue() != null) {
+ if ((ovsdbNodeRef != null) && (ovsdbNodeRef.getValue() != null)) {
final UUID bridgeUuid = UUID.randomUUID();
final OvsdbBridgeAugmentation ovsdbBridge = new OvsdbBridgeAugmentationBuilder()
.setBridgeName(
private static String getSpeed(Speed speedObject) {
String speed = null;
if (speedObject instanceof Speed10M) {
- // map to 1MB
- speed = "1000000";
+ // map to 10MB
+ speed = "10000000";
}
else if (speedObject instanceof Speed100M) {
- // map to 2MB
- speed = "2000000";
+ // map to 20MB
+ speed = "20000000";
}
else if (speedObject instanceof Speed1G) {
- // map to 3MB
- speed = "3000000";
+ // map to 30MB
+ speed = "30000000";
}
else if (speedObject instanceof Speed10G) {
- // map to 4MB
- speed = "4000000";
+ // map to 40MB
+ speed = "40000000";
}
return speed;
}
public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extract(
Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz) {
final Map<InstanceIdentifier<T>,T> result = new HashMap<InstanceIdentifier<T>,T>();
- if (changes != null && changes.entrySet() != null) {
+ if ((changes != null) && (changes.entrySet() != null)) {
for (final Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) {
if (klazz.isInstance(created.getValue())) {
@SuppressWarnings("unchecked")
public static <T extends DataObject> Set<InstanceIdentifier<T>> extractRemoved(
AsyncDataChangeEvent<InstanceIdentifier<?>,DataObject> changes,Class<T> klazz) {
final Set<InstanceIdentifier<T>> result = new HashSet<InstanceIdentifier<T>>();
- if (changes != null && changes.getRemovedPaths() != null) {
+ if ((changes != null) && (changes.getRemovedPaths() != null)) {
for (final InstanceIdentifier<?> iid : changes.getRemovedPaths()) {
if (iid.getTargetType().equals(klazz)) {
@SuppressWarnings("unchecked") // Actually checked above
final Topology topology = UnimgrUtils.read(dataBroker,
LogicalDatastoreType.OPERATIONAL,
evcTopology);
- if (topology != null && topology.getLink() != null) {
+ if ((topology != null) && (topology.getLink() != null)) {
for (final Link link : topology.getLink()) {
final EvcAugmentation evcAugmentation = link.getAugmentation(EvcAugmentation.class);
if (evcAugmentation != null) {
final Topology topology = UnimgrUtils.read(dataBroker,
LogicalDatastoreType.OPERATIONAL,
ovsdbTopoIdentifier);
- if (topology != null && topology.getNode() != null) {
+ if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
if (ovsdbNodeAugmentation != null) {
final Topology topology = read(dataBroker,
LogicalDatastoreType.CONFIGURATION,
topologyInstanceIdentifier);
- if (topology != null && topology.getNode() != null) {
+ if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
final Topology topology = read(dataBroker,
store,
topologyInstanceIdentifier);
- if (topology != null && topology.getNode() != null) {
+ if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
final Topology topology = read(dataBroker,
store,
topologyInstanceIdentifier);
- if (topology != null && topology.getNode() != null) {
+ if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
if (uniAugmentation != null) {
final Topology topology = read(dataBroker,
store,
topologyInstanceIdentifier);
- if (topology != null && topology.getNode() != null) {
+ if ((topology != null) && (topology.getNode() != null)) {
for (final Node node : topology.getNode()) {
final UniAugmentation uniAugmentation = node.getAugmentation(UniAugmentation.class);
- if (uniAugmentation != null && uniAugmentation.getIpAddress().getIpv4Address().getValue().equals(ipAddress.getIpv4Address().getValue())) {
+ if ((uniAugmentation != null) && uniAugmentation.getIpAddress().getIpv4Address().getValue().equals(ipAddress.getIpv4Address().getValue())) {
return uniAugmentation;
}
}
InstanceIdentifier<?> destinationUniIid,
DataBroker dataBroker) {
final EvcAugmentationBuilder updatedEvcBuilder = new EvcAugmentationBuilder(evcAugmentation);
- if (sourceUniIid != null && destinationUniIid != null) {
+ if ((sourceUniIid != null) && (destinationUniIid != null)) {
final List<UniSource> sourceList = new ArrayList<UniSource>();
final UniSourceKey sourceKey = evcAugmentation.getUniSource().iterator().next().getKey();
final short sourceOrder = evcAugmentation.getUniSource().iterator().next().getOrder();