... instead of Guava's, where appropriate.
Change-Id: I4f20e86bd65d5b7a530fa631721d1ed7a4345c19
Signed-off-by: Stephen Kitt <skitt@redhat.com>
package org.opendaylight.ovsdb.hwvtepsouthbound;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
public class HwvtepConnectionInstance {
private void monitorAllTables(String database, DatabaseSchema dbSchema) {
Set<String> tables = dbSchema.getTables();
if (tables != null) {
- List<MonitorRequest> monitorRequests = Lists.newArrayList();
+ List<MonitorRequest> monitorRequests = new ArrayList<>();
for (String tableName : tables) {
if (!HwvtepSouthboundConstants.SKIP_HWVTEP_TABLE.containsKey(tableName)) {
LOG.info("HwvtepSouthbound monitoring Hwvtep schema table {}", tableName);
*/
package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration;
-import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.stream.Collectors;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
static Set<String> getLogicalSwitchesToBeRemoved(Node configNode, Node opNode) {
Set<String> opSwitchNames = new HashSet<>();
Set<String> cfgSwitchNames = new HashSet<>();
- List<LogicalSwitches> cfgLogicalSwitches = Lists.newArrayList();
- List<LogicalSwitches> opLogicalSwitches = Lists.newArrayList();
+ List<LogicalSwitches> cfgLogicalSwitches = new ArrayList<>();
+ List<LogicalSwitches> opLogicalSwitches = new ArrayList<>();
if (opNode != null && opNode.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
opLogicalSwitches = opNode.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
*/
package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration;
-import com.google.common.collect.Lists;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder;
} else {
newNodeBuilder = new NodeBuilder();
}
- List<TerminationPoint> emptyList = Lists.newArrayList();
+ List<TerminationPoint> emptyList = new ArrayList<>();
newNodeBuilder.setTerminationPoint(emptyList);
return newNodeBuilder;
static List<TerminationPoint> getPorts(Node node) {
- ArrayList<TerminationPoint> tpList = Lists.newArrayList();
+ ArrayList<TerminationPoint> tpList = new ArrayList<>();
if (node == null || node.getTerminationPoint() == null) {
return tpList;
}
import java.util.Objects;
import java.util.Set;
-import com.google.common.collect.Lists;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
//If this key itself is in transit wait for the response of this key itself
if (deviceInfo.isKeyInTransit((Class<? extends Identifiable>) classType, key)) {
- inTransitDependencies.put(classType, Lists.newArrayList(key));
+ inTransitDependencies.put(classType, Collections.singletonList(key));
}
if (HwvtepSouthboundUtil.isEmptyMap(confingDependencies) && HwvtepSouthboundUtil.isEmptyMap(inTransitDependencies)) {
if (augmentation != null) {
List<T> data = getData(augmentation);
if (data != null) {
- return Lists.newArrayList(data);
+ return new ArrayList<>(data);
}
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
protected Map<InstanceIdentifier<Node>, List<T>> extractRemoved(
Collection<DataTreeModification<Node>> changes, Class<T> class1) {
Map<InstanceIdentifier<Node>, List<T>> result = new HashMap<>();
- List<T> removed = Collections.EMPTY_LIST;
if (changes != null && !changes.isEmpty()) {
for (DataTreeModification<Node> change : changes) {
final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
Class<? extends Identifiable> classType = (Class<? extends Identifiable>) getClassType();
+ List<T> removed;
if (operationalState.isInReconciliation()) {
removed = getRemoved(change);
} else {
List<T> data1 = getData(include);
List<T> data2 = diffOf(a, b, compareKeyOnly);
if (HwvtepSouthboundUtil.isEmpty(data1) && HwvtepSouthboundUtil.isEmpty(data2)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- List<T> result = Lists.newArrayList(data1);
+ List<T> result = new ArrayList<>(data1);
result.addAll(data2);
return result;
}
List<T> list2 = getData(b);
if (HwvtepSouthboundUtil.isEmpty(list1)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
if (HwvtepSouthboundUtil.isEmpty(list2)) {
- return HwvtepSouthboundUtil.isEmpty(list1) ? Collections.EMPTY_LIST : list1;
+ return HwvtepSouthboundUtil.isEmpty(list1) ? Collections.emptyList() : list1;
}
Iterator<T> it1 = list1.iterator();
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
private Map<InstanceIdentifier<Node>, Node> operationalNodes = new HashMap<>();
private ReadWriteTransaction transaction;
- HashMap<InstanceIdentifier<TerminationPoint>, UUID> inflightLocators = Maps.newHashMap();
+ HashMap<InstanceIdentifier<TerminationPoint>, UUID> inflightLocators = new HashMap<>();
private HwvtepDeviceInfo deviceInfo;
private HwvtepConnectionInstance connectionInstance;
private Map<Class<? extends Identifiable>, Map<InstanceIdentifier, UUID>> currentTxUUIDs = new ConcurrentHashMap<>();
/*
- * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright © 2015, 2017 China Telecom Beijing Research Institute and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import java.util.Map;
import java.util.Map.Entry;
-import com.google.common.collect.Lists;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
public static class MacDependencyGetter extends UnMetDependencyGetter<LocalMcastMacs> {
public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(LocalMcastMacs data) {
- return Lists.newArrayList(data.getLogicalSwitchRef().getValue());
+ return Collections.singletonList(data.getLogicalSwitchRef().getValue());
}
@Override
public List<InstanceIdentifier<?>> getTerminationPointDependencies(LocalMcastMacs data) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
}
}
import java.util.Map.Entry;
import java.util.Objects;
-import com.google.common.collect.Lists;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(RemoteMcastMacs data) {
if (data == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- return Lists.newArrayList(data.getLogicalSwitchRef().getValue());
+ return Collections.singletonList(data.getLogicalSwitchRef().getValue());
}
public List<InstanceIdentifier<?>> getTerminationPointDependencies(RemoteMcastMacs data) {
if (data == null || HwvtepSouthboundUtil.isEmpty(data.getLocatorSet())) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<InstanceIdentifier<?>> locators = new ArrayList<>();
for (LocatorSet locator: data.getLocatorSet()) {
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
public class PhysicalPortRemoveCommand extends AbstractTransactCommand {
private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
transaction.add(op.comment("Physical Port: Deleting " + port.getHwvtepNodeName().getValue()));
transaction.add(op.mutate(physicalSwitch.getSchema())
.addMutation(physicalSwitch.getPortsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(physicalPortUuid)));
+ Collections.singleton(physicalPortUuid)));
transaction.add(op.comment("Physical Switch: Mutating " + port.getHwvtepNodeName().getValue() + " " + physicalPortUuid));
} else {
LOG.warn("Unable to delete logical switch {} because it was not found in the operational store, "
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortUpdateCommand.class);
//update physical switch table
PhysicalSwitch physicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalSwitch.class);
physicalSwitch.setName(physicalSwitchBelong.getHwvtepNodeName().getValue());
- physicalSwitch.setPorts(Sets.newHashSet(new UUID(portUuid)));
+ physicalSwitch.setPorts(Collections.singleton(new UUID(portUuid)));
LOG.trace("execute: mutating physical switch: {}", physicalSwitch);
transaction.add(op.mutate(physicalSwitch)
.addMutation(physicalSwitch.getPortsColumn().getSchema(), Mutator.INSERT,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
public class PhysicalSwitchRemoveCommand extends AbstractTransactCommand {
private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchRemoveCommand.class);
transaction.add(op.comment("Physical Switch: Deleting " + physicalSwitchAugmentation.getHwvtepNodeName().getValue()));
transaction.add(op.mutate(global.getSchema())
.addMutation(global.getSwitchesColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(physicalSwitchUuid)));
+ Collections.singleton(physicalSwitchUuid)));
transaction.add(op.comment("Global: Mutating " + physicalSwitchAugmentation.getHwvtepNodeName().getValue() + " " + physicalSwitchUuid));
} else {
LOG.warn("Unable to delete physical switch {} because it was not found in the operational store",
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
physicalSwitchAugmentation.getHwvtepNodeName().getValue()));
//update global table
Global global = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Global.class);
- global.setSwitches(Sets.newHashSet(new UUID(pswitchUuid)));
+ global.setSwitches(Collections.singleton(new UUID(pswitchUuid)));
LOG.trace("execute: create physical switch: {}", physicalSwitch);
transaction.add(op.mutate(global)
PhysicalSwitch pSwitch =
TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
PhysicalSwitch.class);
- pSwitch.setTunnels(Sets.newHashSet(new UUID(tunnelUuid)));
+ pSwitch.setTunnels(Collections.singleton(new UUID(tunnelUuid)));
pSwitch.setName(physicalSwitchAugmentation.getHwvtepNodeName().getValue());
transaction.add(op.mutate(pSwitch)
.addMutation(pSwitch.getTunnels().getSchema(), Mutator.INSERT,
/*
- * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others. All rights reserved.
+ * Copyright © 2015, 2017 China Telecom Beijing Research Institute and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import java.util.Map;
import java.util.Map.Entry;
-import com.google.common.collect.Lists;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
public static class MacDependencyGetter extends UnMetDependencyGetter<LocalUcastMacs> {
@Override
public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(LocalUcastMacs data) {
- return Lists.newArrayList(data.getLogicalSwitchRef().getValue());
+ return Collections.singletonList(data.getLogicalSwitchRef().getValue());
}
@Override
public List<InstanceIdentifier<?>> getTerminationPointDependencies(LocalUcastMacs data) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
}
}
\ No newline at end of file
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import com.google.common.collect.Lists;
-
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
import org.opendaylight.ovsdb.lib.notation.UUID;
public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(RemoteUcastMacs data) {
if (data == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- return Lists.newArrayList(data.getLogicalSwitchRef().getValue());
+ return Collections.singletonList(data.getLogicalSwitchRef().getValue());
}
public List<InstanceIdentifier<?>> getTerminationPointDependencies(RemoteUcastMacs data) {
if (data == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- return Lists.newArrayList(data.getLocatorRef().getValue());
+ return Collections.singletonList(data.getLocatorRef().getValue());
}
}
}
\ No newline at end of file
/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright © 2016, 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.hwvtepsouthbound;
import com.google.common.collect.Lists;
+import java.util.ArrayList;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
public static final String VXLAN_OVER_IPV4 = "vxlan_over_ipv4";
public static List<LogicalSwitches> addLogicalSwitches(HwvtepGlobalAugmentationBuilder augmentationBuilder, String[]... data) {
- List<LogicalSwitches> logicalSwitcheses = Lists.newArrayList();
+ List<LogicalSwitches> logicalSwitcheses = new ArrayList<>();
for (String row[] : data) {
logicalSwitcheses.add(TestBuilders.buildLogicalSwitch(row));
}
public static List<RemoteMcastMacs> addRemoteMcastMacs(InstanceIdentifier<Node> iid,
HwvtepGlobalAugmentationBuilder augmentationBuilder, String[]... data) {
- List<RemoteMcastMacs> remoteMcastMacses = Lists.newArrayList();
+ List<RemoteMcastMacs> remoteMcastMacses = new ArrayList<>();
for (String row[] : data) {
String teps[] = Arrays.copyOfRange(row, 2, row.length);
remoteMcastMacses.add(TestBuilders.buildRemoteMcastMacs(iid, row[0], row[1], teps));
public static List<RemoteUcastMacs> addRemoteUcastMacs(InstanceIdentifier<Node> iid,
HwvtepGlobalAugmentationBuilder augmentationBuilder,
String[]... data) {
- List<RemoteUcastMacs> remoteUcastMacses = Lists.newArrayList();
+ List<RemoteUcastMacs> remoteUcastMacses = new ArrayList<>();
for (String row[] : data) {
remoteUcastMacses.add(TestBuilders.buildRemoteUcastMacs(iid, row[0], row[1], row[2], row[3]));
}
public static void addGlobalTerminationPoints(NodeBuilder nodeBuilder, InstanceIdentifier<Node> nodeIid,
String[]... data) {
- List<TerminationPoint> terminationPoints = Lists.newArrayList();
+ List<TerminationPoint> terminationPoints = new ArrayList<>();
for (String row[] : data) {
terminationPoints.add(TestBuilders.buildTerminationPoint(nodeIid, row[0]));
}
}
mMacLocalBuilder.setMacEntryUuid(getUUid(mac));
mMacLocalBuilder.setLogicalSwitchRef(buildLogicalSwitchesRef(iid, logicalSwitchName));
- List<LocatorSet> locatorSets = Lists.newArrayList();
+ List<LocatorSet> locatorSets = new ArrayList<>();
for (String tepIp : tepIps) {
locatorSets.add(new LocatorSetBuilder().setLocatorRef(
buildLocatorRef(iid, tepIp)).build());
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.netty.channel.Channel;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
private static final Logger LOG = LoggerFactory.getLogger(OvsdbClientImpl.class);
private ExecutorService executorService;
private OvsdbRPC rpc;
- private Map<String, DatabaseSchema> schemas = Maps.newHashMap();
- private Map<String, CallbackContext> monitorCallbacks = Maps.newHashMap();
+ private Map<String, DatabaseSchema> schemas = new HashMap<>();
+ private Map<String, CallbackContext> monitorCallbacks = new HashMap<>();
private OvsdbRPC.Callback rpcCallback;
private OvsdbConnectionInfo connectionInfo;
private Channel channel;
protected TableUpdates transformingCallback(JsonNode tableUpdatesJson, DatabaseSchema dbSchema) {
//todo(ashwin): we should move all the JSON parsing logic to a utility class
if (tableUpdatesJson instanceof ObjectNode) {
- Map<String, TableUpdate> tableUpdateMap = Maps.newHashMap();
+ Map<String, TableUpdate> tableUpdateMap = new HashMap<>();
ObjectNode updatesJson = (ObjectNode) tableUpdatesJson;
for (Iterator<Map.Entry<String,JsonNode>> itr = updatesJson.fields(); itr.hasNext();) {
Map.Entry<String, JsonNode> entry = itr.next();
registerCallback(monitorHandle, callback, dbSchema);
ListenableFuture<JsonNode> monitor = rpc.monitor(
- () -> Lists.newArrayList(dbSchema.getName(), monitorHandle.getId(), reqMap));
+ () -> Arrays.asList(dbSchema.getName(), monitorHandle.getId(), reqMap));
JsonNode result;
try {
result = monitor.get();
registerCallback(monitorHandle, callback, dbSchema);
ListenableFuture<JsonNode> monitor = rpc.monitor(
- () -> Lists.newArrayList(dbSchema.getName(), monitorHandle.getId(), reqMap));
+ () -> Arrays.asList(dbSchema.getName(), monitorHandle.getId(), reqMap));
JsonNode result;
try {
result = monitor.get();
@Override
public void cancelMonitor(final MonitorHandle handler) {
- ListenableFuture<JsonNode> cancelMonitor = rpc.monitor_cancel(() -> Lists.newArrayList(handler.getId()));
+ ListenableFuture<JsonNode> cancelMonitor = rpc.monitor_cancel(() -> Collections.singletonList(handler.getId()));
JsonNode result = null;
try {
if (databaseSchema == null) {
return Futures.transform(
- getSchemaFromDevice(Lists.newArrayList(database)),
+ getSchemaFromDevice(Collections.singletonList(database)),
(Function<Map<String, DatabaseSchema>, DatabaseSchema>) result -> {
if (result.containsKey(database)) {
DatabaseSchema dbSchema = result.get(database);
}
private ListenableFuture<Map<String, DatabaseSchema>> getSchemaFromDevice(final List<String> dbNames) {
- Map<String, DatabaseSchema> schema = Maps.newHashMap();
+ Map<String, DatabaseSchema> schema = new HashMap<>();
SettableFuture<Map<String, DatabaseSchema>> future = SettableFuture.create();
populateSchema(dbNames, schema, future);
return future;
return;
}
- Futures.transform(rpc.get_schema(Lists.newArrayList(dbNames.get(0))),
+ Futures.transform(rpc.get_schema(Collections.singletonList(dbNames.get(0))),
(Function<JsonNode, Void>) jsonNode -> {
try {
schema.put(dbNames.get(0), DatabaseSchema.fromJson(dbNames.get(0), jsonNode));
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
private static ExecutorService connectionNotifierService
= Executors.newCachedThreadPool(connectionNotifierThreadFactory);
- private static Set<OvsdbConnectionListener> connectionListeners = Sets.newHashSet();
+ private static Set<OvsdbConnectionListener> connectionListeners = new HashSet<>();
private static Map<OvsdbClient, Channel> connections = new ConcurrentHashMap<>();
private static OvsdbConnection connectionService;
private static AtomicBoolean singletonCreated = new AtomicBoolean(false);
/*
- * Copyright (c) 2013, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2013, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.jsonrpc;
import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
public class JsonRpc10Request {
String id;
String method;
- List<Object> params = Lists.newArrayList();
+ List<Object> params = new ArrayList<>();
public JsonRpc10Request(String id) {
setId(id);
/*
- * Copyright (c) 2013, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2013, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.jsonrpc;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
public class JsonRpc10Response {
String id;
String error;
- List<Object> result = Lists.newArrayList();
+ List<Object> result = new ArrayList<>();
public JsonRpc10Response(String id) {
setId(id);
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.google.common.collect.Maps;
import com.google.common.reflect.Invokable;
import com.google.common.reflect.Reflection;
import com.google.common.reflect.TypeToken;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
ObjectMapper objectMapper;
Channel nettyChannel;
- Map<String, CallContext> methodContext = Maps.newHashMap();
- Map<Object, OvsdbRPC.Callback> requestCallbacks = Maps.newHashMap();
+ Map<String, CallContext> methodContext = new HashMap<>();
+ Map<Object, OvsdbRPC.Callback> requestCallbacks = new HashMap<>();
public JsonRpcEndpoint(ObjectMapper objectMapper, Channel channel) {
this.objectMapper = objectMapper;
/*
- * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.message;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
public TableUpdate() {
super();
- rows = Maps.newHashMap();
+ rows = new HashMap<>();
}
public void addRow(UUID uuid, Row<E> oldRow, Row<E> newRow) {
package org.opendaylight.ovsdb.lib.message;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.ovsdb.lib.schema.TableSchema;
public class TableUpdates extends Response {
- Map<String, TableUpdate> map = Maps.newHashMap();
+ private final Map<String, TableUpdate> map = new HashMap<>();
- public TableUpdates() {
- this(Maps.newHashMap());
- }
+ public TableUpdates() {}
public TableUpdates(Map<String, TableUpdate> map) {
- this.map = map;
+ this.map.putAll(map);
}
public <E extends TableSchema<E>> TableUpdate<E> getUpdate(TableSchema<E> table) {
/*
- * Copyright (c) 2013, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2013, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.message;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.ovsdb.lib.jsonrpc.Params;
import org.opendaylight.ovsdb.lib.operations.Operation;
public class TransactBuilder implements Params {
- List<Operation> requests = Lists.newArrayList();
- DatabaseSchema dbSchema;
+ private List<Operation> requests = new ArrayList<>();
+ private DatabaseSchema dbSchema;
public TransactBuilder(DatabaseSchema dbSchema) {
this.dbSchema = dbSchema;
@Override
public List<Object> params() {
- List<Object> lists = Lists.newArrayList((Object)dbSchema.getName());
- lists.addAll(requests);
- return lists;
+ List<Object> list = new ArrayList<>(requests.size() + 1);
+ list.add(dbSchema.getName());
+ list.addAll(requests);
+ return list;
}
public void addOperations(List<Operation> operation) {
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ForwardingMap;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.ovsdb.lib.notation.json.Converter;
import org.opendaylight.ovsdb.lib.notation.json.OvsdbMapSerializer;
@JsonSerialize(using = OvsdbMapSerializer.class)
public class OvsdbMap<K, V> extends ForwardingMap<K, V> {
- Map<K, V> target = Maps.newHashMap();
+ private final Map<K, V> target = new HashMap<>();
- public OvsdbMap() {
- this(Maps.newHashMap());
- }
+ public OvsdbMap() {}
public OvsdbMap(Map<K, V> value) {
- this.target = value;
+ this.target.putAll(value);
}
@Override
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ForwardingSet;
-import com.google.common.collect.Sets;
+import java.util.HashSet;
import java.util.Set;
import org.opendaylight.ovsdb.lib.notation.json.Converter;
import org.opendaylight.ovsdb.lib.notation.json.OvsdbSetSerializer;
@JsonSerialize(using = OvsdbSetSerializer.class)
public class OvsdbSet<T> extends ForwardingSet<T> {
- Set<T> target = null;
+ Set<T> target = new HashSet<>();
- public OvsdbSet() {
- this(Sets.newHashSet());
- }
+ public OvsdbSet() {}
public OvsdbSet(Set<T> backing) {
this.target = backing;
/*
- * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.google.common.collect.Maps;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.opendaylight.ovsdb.lib.notation.json.RowSerializer;
public class Row<E extends TableSchema<E>> {
@JsonIgnore
private TableSchema<E> tableSchema;
- protected Map<String, Column<E, ?>> columns;
+ protected Map<String, Column<E, ?>> columns = new HashMap<>();
- public Row() {
- this.columns = Maps.newHashMap();
- }
+ public Row() {}
public Row(TableSchema<E> tableSchema) {
this.tableSchema = tableSchema;
- this.columns = Maps.newHashMap();
}
public Row(TableSchema<E> tableSchema, List<Column<E, ?>> columns) {
this.tableSchema = tableSchema;
- this.columns = Maps.newHashMap();
for (Column<E, ?> column : columns) {
this.columns.put(column.getSchema().getName(), column);
}
/*
- * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.operations;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.ovsdb.lib.notation.Condition;
import org.opendaylight.ovsdb.lib.schema.TableSchema;
public class Delete<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
public static final String DELETE = "delete";
- List<Condition> where = Lists.newArrayList();
+ List<Condition> where = new ArrayList<>();
Integer count;
public Delete(TableSchema<E> schema) {
/*
- * Copyright (c) 2014 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.operations;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.notation.Row;
@JsonProperty("uuid-name")
private String uuidName;
- private Map<String, Object> row = Maps.newHashMap();
+ private Map<String, Object> row = new HashMap<>();
public Insert<E> on(TableSchema<E> schema) {
this.setTableSchema(schema);
/*
- * Copyright (c) 2014, 2015 Matt Oswalt and others. All rights reserved.
+ * Copyright © 2014, 2017 Matt Oswalt and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
*/
package org.opendaylight.ovsdb.lib.operations;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.ovsdb.lib.notation.Condition;
import org.opendaylight.ovsdb.lib.notation.Mutation;
public class Mutate<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
public static final String MUTATE = "mutate";
- List<Condition> where = Lists.newArrayList();
- private List<Mutation> mutations = Lists.newArrayList();
+ List<Condition> where = new ArrayList<>();
+ private List<Mutation> mutations = new ArrayList<>();
public Mutate on(TableSchema schema) {
this.setTableSchema(schema);
/*
- * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.operations;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.ovsdb.lib.notation.Condition;
import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
public class Select<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
public static final String SELECT = "select";
- List<Condition> where = Lists.newArrayList();
- private List<String> columns = Lists.newArrayList();
+ private List<Condition> where = new ArrayList<>();
+ private List<String> columns = new ArrayList<>();
public Select on(TableSchema schema) {
this.setTableSchema(schema);
/*
- * Copyright (c) 2014 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.operations;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
private DatabaseSchema databaseSchema;
OvsdbClient ovs;
- List<Operation> operations = Lists.newArrayList();
+ List<Operation> operations = new ArrayList<>();
public TransactionBuilder(OvsdbClient ovs, DatabaseSchema schema) {
this.ovs = ovs;
/*
- * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.operations;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.opendaylight.ovsdb.lib.notation.Column;
public static final String UPDATE = "update";
- Map<String, Object> row = Maps.newHashMap();
- String uuid;
+ private final Map<String, Object> row = new HashMap<>();
+ private String uuid;
- List<Condition> where = Lists.newArrayList();
+ private final List<Condition> where = new ArrayList<>();
private String uuidName;
}
public void setRow(Map<String, Object> row) {
- this.row = row;
+ this.row.clear();
+ this.row.putAll(row);
}
@Override
}
public void setWhere(List<Condition> where) {
- this.where = where;
+ this.where.clear();
+ this.where.addAll(where);
}
}
/*
- * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
+ * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.ovsdb.lib.schema;
import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
+import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import org.opendaylight.ovsdb.lib.error.TyperException;
private Optional<Set<Integer>> populateEnum(JsonNode node) {
if (node.has("enum")) {
- Set<Integer> nodesEnums = Sets.newHashSet();
+ Set<Integer> nodesEnums = new HashSet<>();
JsonNode anEnum = node.get("enum").get(1);
for (JsonNode enm : anEnum) {
nodesEnums.add(enm.asInt());
private Optional<Set<Double>> populateEnum(JsonNode node) {
if (node.has("enum")) {
- Set<Double> nodesEnums = Sets.newHashSet();
+ Set<Double> nodesEnums = new HashSet<>();
JsonNode anEnum = node.get("enum").get(1);
for (JsonNode enm : anEnum) {
nodesEnums.add(enm.asDouble());
private Optional<Set<String>> populateEnum(JsonNode node) {
if (node.has("enum")) {
- Set<String> nodesEnums = Sets.newHashSet();
+ Set<String> nodesEnums = new HashSet<>();
JsonNode enumVal = node.get("enum");
if (enumVal.isArray()) {
JsonNode anEnum = enumVal.get(1);
/*
- * Copyright (C) 2014 EBay Software Foundation
+ * Copyright © 2014, 2017 EBay Software Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
assertNotNull(dbSchema);
GenericTableSchema bridge = dbSchema.table("Bridge", GenericTableSchema.class);
- List<MonitorRequest> monitorRequests = Lists.newArrayList();
+ List<MonitorRequest> monitorRequests = new ArrayList<>();
ColumnSchema<GenericTableSchema, Set<Integer>> flood_vlans = bridge.multiValuedColumn("flood_vlans", Integer.class);
ColumnSchema<GenericTableSchema, Map<String, String>> externalIds = bridge.multiValuedColumn("external_ids", String.class, String.class);
ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
monitorRequests.add(builder.with(new MonitorSelect(true, true, true, true))
.build());
- final List<Object> results = Lists.newArrayList();
+ final List<Object> results = new ArrayList<>();
TableUpdates updates = ovs.monitor(dbSchema, monitorRequests, new MonitorCallBack() {
@Override
.where(name.opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.mutate(ovsTable)
- .addMutation(bridges, Mutator.INSERT, Sets.newHashSet(new UUID(namedUuid)))
+ .addMutation(bridges, Mutator.INSERT, Collections.singleton(new UUID(namedUuid)))
.where(_uuid.opEqual(parentTable))
.build())
.add(op.commit(true));
.where(name.opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.mutate(ovsTable)
- .addMutation(bridges, Mutator.DELETE, Sets.newHashSet(testBridgeUuid))
+ .addMutation(bridges, Mutator.DELETE, Collections.singleton(testBridgeUuid))
.where(_uuid.opEqual(parentTable))
.build())
.add(op.commit(true))
/*
- * Copyright (C) 2014 EBay Software Foundation
+ * Copyright © 2014, 2017 EBay Software Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
TestBridge rBridge = ovs.createTypedRowWrapper(TestBridge.class);
rBridge.setName(TEST_BRIDGE_NAME);
rBridge.setStatus(ImmutableMap.of("key","value"));
- rBridge.setFloodVlans(Sets.newHashSet(34));
+ rBridge.setFloodVlans(Collections.singleton(34));
GenericTableSchema ovsTable = dbSchema.table("Open_vSwitch", GenericTableSchema.class);
ColumnSchema<GenericTableSchema, Set<UUID>> bridges = ovsTable.multiValuedColumn("bridges", UUID.class);
.add(op.insert(rBridge)
.withId(namedUuid))
.add(op.mutate(ovsTable)
- .addMutation(bridges, Mutator.INSERT, Sets.newHashSet(new UUID(namedUuid))));
+ .addMutation(bridges, Mutator.INSERT, Collections.singleton(new UUID(namedUuid))));
ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
List<OperationResult> operationResults = results.get();
.where(name.opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.mutate(ovsTable)
- .addMutation(bridges, Mutator.DELETE, Sets.newHashSet(testBridgeUuid)))
+ .addMutation(bridges, Mutator.DELETE, Collections.singleton(testBridgeUuid)))
.add(op.commit(true))
.execute();
/*
- * Copyright (C) 2014 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.junit.Assume.assumeTrue;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import com.google.common.collect.Sets;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
String transactionUuidStr = "foobar";
Global glbl = this.getClient().createTypedRowWrapper(Global.class);
- glbl.setManagers(Sets.newHashSet(new UUID(transactionUuidStr)));
+ glbl.setManagers(Collections.singleton(new UUID(transactionUuidStr)));
TransactionBuilder transactionBuilder = getClient().transactBuilder(getDbSchema())
.add(op.insert(manager.getSchema())
.add(op.comment("Manager: Deleting " + testManagerUuid))
.add(op.mutate(global.getSchema())
.addMutation(global.getManagersColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testManagerUuid)))
+ Collections.singleton(testManagerUuid)))
.add(op.comment("Global: Mutating " + testManagerUuid))
.add(op.commit(true));
/*
- * Copyright (C) 2014 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Bridge bridge = getClient().createTypedRowWrapper(Bridge.class);
bridge.setName(TEST_BRIDGE_NAME);
bridge.setStatus(ImmutableMap.of("key", "value"));
- bridge.setFloodVlans(Sets.newHashSet(34L));
+ bridge.setFloodVlans(Collections.singleton(34L));
OpenVSwitch openVSwitch = getClient().createTypedRowWrapper(OpenVSwitch.class);
- openVSwitch.setBridges(Sets.newHashSet(new UUID(TEST_BRIDGE_NAME)));
+ openVSwitch.setBridges(Collections.singleton(new UUID(TEST_BRIDGE_NAME)));
TransactionBuilder transactionBuilder = getClient().transactBuilder(getDbSchema())
.add(op.insert(bridge.getSchema())
.add(op.comment("Bridge: Deleting " + TEST_BRIDGE_NAME))
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(bridgeUuid)))
+ Collections.singleton(bridgeUuid)))
.add(op.comment("Open_vSwitch: Mutating " + TEST_BRIDGE_NAME + " " + bridgeUuid))
.add(op.commit(true));
.add(op.comment("Controller: Inserting controller1 " + controller1.getTargetColumn().getData()))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(controllerUuidStr)))
+ Collections.singleton(new UUID(controllerUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating controller1 " + controller1.getTargetColumn().getData()));
.add(op.comment("Controller: Inserting controller2 " + controller2.getTargetColumn().getData()))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(controllerUuidStr)))
+ Collections.singleton(new UUID(controllerUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating controller2 " + controller2.getTargetColumn().getData()));
.add(op.comment("Controller: Deleting " + testController1Uuid))
.add(op.mutate(bridge.getSchema()) // Delete a controller column in the Bridge table
.addMutation(bridge.getControllerColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testController1Uuid)))
+ Collections.singleton(testController1Uuid)))
.add(op.comment("Bridge: Mutating " + testController1Uuid))
.add(op.commit(true));
.add(op.comment("Controller: Deleting " + testController2Uuid))
.add(op.mutate(bridge.getSchema()) // Delete a controller column in the Bridge table
.addMutation(bridge.getControllerColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testController2Uuid)))
+ Collections.singleton(testController2Uuid)))
.add(op.comment("Bridge: Mutating " + testController2Uuid))
.add(op.commit(true));
.add(op.comment("FlowTable: Deleting " + testFlowTableUuid))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getFlowTablesColumn().getSchema(), Mutator.DELETE,
- Maps.newHashMap(ImmutableMap.of(1L, testFlowTableUuid))))
+ ImmutableMap.of(1L, testFlowTableUuid)))
.add(op.comment("Bridge: Mutating " + testFlowTableUuid))
.add(op.commit(true));
.add(op.comment("IPFIX: Inserting " + ipfixUuidStr))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getIpfixColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(ipfixUuidStr)))
+ Collections.singleton(new UUID(ipfixUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + ipfixUuidStr));
.add(op.comment("IPFIX: Deleting " + testIpfixUuid))
.add(op.mutate(bridge.getSchema()) // Delete a controller column in the Bridge table
.addMutation(bridge.getMirrorsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testIpfixUuid)))
+ Collections.singleton(testIpfixUuid)))
.add(op.comment("Bridge: Mutating " + testIpfixUuid))
.add(op.commit(true));
UUID openVSwitchRowUuid = getOpenVSwitchTableUuid(getClient(), getTableCache());
OpenVSwitch openVSwitch = getClient().getTypedRowWrapper(OpenVSwitch.class, null);
Manager manager = getClient().createTypedRowWrapper(Manager.class);
- manager.setInactivityProbe(Sets.newHashSet(8192L));
- manager.setMaxBackoff(Sets.newHashSet(4094L));
+ manager.setInactivityProbe(Collections.singleton(8192L));
+ manager.setMaxBackoff(Collections.singleton(4094L));
manager.setTarget("tcp:172.16.50.50:6640");
manager.setExternalIds(externalIds);
.add(op.comment("Manager: Inserting Slave Manager " + TEST_MANAGER_UUID_STR))
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getManagerOptionsColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(TEST_MANAGER_UUID_STR)))
+ Collections.singleton(new UUID(TEST_MANAGER_UUID_STR)))
.where(openVSwitch.getUuidColumn().getSchema().opEqual(openVSwitchRowUuid))
.build())
.add(op.comment("Open_vSwitch: Mutating " + TEST_MANAGER_UUID_STR));
.add(op.comment("Manager: Deleting " + TEST_MANAGER_UUID_STR))
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getManagerOptionsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testManagerUuid)))
+ Collections.singleton(testManagerUuid)))
.add(op.comment("Open_vSwitch: Mutating " + TEST_MANAGER_UUID_STR + " " + testManagerUuid))
.add(op.commit(true));
.add(op.comment("Mirror: Inserting " + mirrorUuidStr))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getMirrorsColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(mirrorUuidStr)))
+ Collections.singleton(new UUID(mirrorUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("Mirror: Deleting " + testMirrorUuid))
.add(op.mutate(bridge.getSchema()) // Delete a controller column in the Bridge table
.addMutation(bridge.getMirrorsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testMirrorUuid)))
+ Collections.singleton(testMirrorUuid)))
.add(op.comment("Bridge: Mutating " + testMirrorUuid))
.add(op.commit(true));
.add(op.comment("Mirror: Inserting " + netFlowUuidStr))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getNetflowColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(netFlowUuidStr)))
+ Collections.singleton(new UUID(netFlowUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("NetFlow: Deleting " + testNetFlowUuid))
.add(op.mutate(bridge.getSchema()) // Delete a controller column in the Bridge table
.addMutation(bridge.getNetflowColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testNetFlowUuid)))
+ Collections.singleton(testNetFlowUuid)))
.add(op.comment("Bridge: Mutating " + testNetFlowUuid))
.add(op.commit(true));
.build())
.add(op.comment("Interface: Updating " + intfUuidStr))
.add(op.mutate(bridge.getSchema())
- .addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT, Sets.newHashSet(new UUID(portUuidStr)))
+ .addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT, Collections.singleton(new UUID(portUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("Interface: Deleting " + testInterfaceUuid))
.add(op.mutate(bridge.getSchema()) // Delete a port column in the Bridge table
.addMutation(bridge.getPortsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testPortUuid)))
+ Collections.singleton(testPortUuid)))
.add(op.comment("Bridge: Mutating " + testPortUuid))
.add(op.commit(true));
.add(op.comment("Autoattach: Inserting " + autoattachUuid))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getAutoAttachColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(autoattachUuid)))
+ Collections.singleton(new UUID(autoattachUuid)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("AutoAttach: Deleting " + testAutoattachUuid))
.add(op.mutate(bridge.getSchema()) // Delete auto_attach column in the Bridge table
.addMutation(bridge.getAutoAttachColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testAutoattachUuid)))
+ Collections.singleton(testAutoattachUuid)))
.add(op.comment("Bridge: Mutating " + testAutoattachUuid))
.add(op.commit(true));
executeTransaction(transactionBuilder, "AutoAttach, Bridge auto_attach column: Delete operation results");
.add(op.comment("Interface: Updating " + intfUuidStr))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(portUuidStr)))
+ Collections.singleton(new UUID(portUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("Qos: Deleting " + testQosUuid))
.add(op.mutate(bridge.getSchema()) // Delete a port column in the Bridge table
.addMutation(bridge.getPortsColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testPortUuid)))
+ Collections.singleton(testPortUuid)))
.add(op.comment("Bridge: Mutating " + testPortUuid))
.add(op.mutate(port.getSchema()) // Delete a qos column in the Port table
.addMutation(port.getQosColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testQosUuid)))
+ Collections.singleton(testQosUuid)))
.add(op.comment("Port: Mutating " + testPortUuid))
.add(op.commit(true));
.add(op.comment("Queue: Deleting " + testQueueUuid))
.add(op.mutate(qos.getSchema()) // Delete a queue column in the Qos table
.addMutation(qos.getQueuesColumn().getSchema(), Mutator.DELETE,
- Maps.newHashMap(ImmutableMap.of(0L,testQueueUuid))))
+ ImmutableMap.of(0L,testQueueUuid)))
.add(op.comment("Queue: Mutating " + testQueueUuid))
.add(op.commit(true));
.add(op.comment("sFlow: Inserting " + sFlowUuidStr))
.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getSflowColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(sFlowUuidStr)))
+ Collections.singleton(new UUID(sFlowUuidStr)))
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
.add(op.comment("Bridge: Mutating " + TEST_BRIDGE_NAME));
.add(op.comment("SFlow: Deleting " + testSFlowUuid))
.add(op.mutate(bridge.getSchema()) // Delete an sflow column in the Bridge table
.addMutation(bridge.getSflowColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testSFlowUuid)))
+ Collections.singleton(testSFlowUuid)))
.add(op.comment("Bridge: Mutating " + testSFlowUuid))
.add(op.commit(true));
.add(op.comment("SSL: Inserting " + sslUuidStr))
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getSslColumn().getSchema(), Mutator.INSERT,
- Sets.newHashSet(new UUID(sslUuidStr)))
+ Collections.singleton(new UUID(sslUuidStr)))
.where(openVSwitch.getUuidColumn().getSchema().opEqual(openVSwitchRowUuid))
.build())
.add(op.comment("Open_vSwitch: Mutating " + sslUuidStr));
.add(op.comment("SSL: Deleting " + testSslUuid))
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getSslColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(testSslUuid)))
+ Collections.singleton(testSslUuid)))
.add(op.comment("Open_vSwitch: Mutating " + testSslUuid))
.add(op.commit(true));
assertNotNull(bridge);
bridge.setName(TEST_BRIDGE_NAME);
bridge.setStatus(ImmutableMap.of("key", "value"));
- bridge.setFloodVlans(Sets.newHashSet(34L));
+ bridge.setFloodVlans(Collections.singleton(34L));
assertNotNull(bridge.toString());
Bridge nullRowBridge = getClient().getTypedRowWrapper(Bridge.class, null);
assertNotNull(bridge);
bridge.setName(TEST_BRIDGE_NAME);
bridge.setStatus(ImmutableMap.of("key", "value"));
- bridge.setFloodVlans(Sets.newHashSet(34L));
+ bridge.setFloodVlans(Collections.singleton(34L));
assertTrue("Equals check on same Bridge object", bridge.equals(bridge));
assertNotNull(bridge);
bridge.setName(TEST_BRIDGE_NAME);
bridge.setStatus(ImmutableMap.of("key", "value"));
- bridge.setFloodVlans(Sets.newHashSet(34L));
+ bridge.setFloodVlans(Collections.singleton(34L));
assertNotSame(bridge.hashCode(), 0);
Bridge nullRowBridge = getClient().getTypedRowWrapper(Bridge.class, null);
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
@RunWith(PaxExam.class)
Bridge bridge = ovsdbClient.createTypedRowWrapper(Bridge.class);
bridge.setName(TEST_BRIDGE_NAME);
bridge.setStatus(ImmutableMap.of("key", "value"));
- bridge.setFloodVlans(Sets.newHashSet(34L));
+ bridge.setFloodVlans(Collections.singleton(34L));
OpenVSwitch openVSwitch = ovsdbClient.createTypedRowWrapper(OpenVSwitch.class);
- openVSwitch.setBridges(Sets.newHashSet(new UUID(TEST_BRIDGE_NAME)));
+ openVSwitch.setBridges(Collections.singleton(new UUID(TEST_BRIDGE_NAME)));
int insertOperationIndex = 0;
.build())
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getBridgesColumn().getSchema(),
- Mutator.DELETE, Sets.newHashSet(testBridgeUuid)))
+ Mutator.DELETE, Collections.singleton(testBridgeUuid)))
.add(op.commit(true))
.execute();
/*
- * Copyright © 2015, 2016 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
assertNotNull(getDbSchema());
- List<MonitorRequest> monitorRequests = Lists.newArrayList();
+ List<MonitorRequest> monitorRequests = new ArrayList<>();
Set<String> tables = getDbSchema().getTables();
assertNotNull("ovsdb tables should not be null", tables);
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
private void monitorTables(String database, DatabaseSchema dbSchema) {
Set<String> tables = dbSchema.getTables();
if (tables != null) {
- List<MonitorRequest> monitorRequests = Lists.newArrayList();
+ List<MonitorRequest> monitorRequests = new ArrayList<>();
for (String tableName : tables) {
if (!SouthboundConstants.SKIP_OVSDB_TABLE.contains(tableName)) {
LOG.info("Southbound monitoring OVSDB schema table {}", tableName);
/*
- * Copyright (c) 2016 Inocybe Technologies and others. All rights reserved.
+ * Copyright © 2016, 2017 Inocybe Technologies and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
transaction.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getAutoAttachColumn().getSchema(),
- Mutator.DELETE, Sets.newHashSet(uuid))
+ Mutator.DELETE, Collections.singleton(uuid))
.where(bridge.getNameColumn().getSchema()
.opEqual(bridgeAugmentation.getBridgeName().getValue())).build());
/*
- * Copyright (c) 2016 Inocybe Technologies and others. All rights reserved.
+ * Copyright © 2016, 2017 Inocybe Technologies and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
final OvsdbBridgeAugmentation ovsdbBridgeAugmentation = getBridge(iid, bridgeUri);
if (ovsdbBridgeAugmentation != null) {
bridge.setName(ovsdbBridgeAugmentation.getBridgeName().getValue());
- bridge.setAutoAttach(Sets.newHashSet(new UUID(namedUuid)));
+ bridge.setAutoAttach(Collections.singleton(new UUID(namedUuid)));
LOG.trace("Create Autoattach table {}, and mutate the bridge {}",
autoAttach.getAutoattachId(), getBridge(iid, bridgeUri).getBridgeName().getValue());
transaction.add(op.mutate(bridge)
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
transaction.add(op.comment("Bridge: Deleting " + original.getBridgeName()));
transaction.add(op.mutate(ovs.getSchema())
.addMutation(ovs.getBridgesColumn().getSchema(), Mutator.DELETE,
- Sets.newHashSet(bridgeUuid)));
+ Collections.singleton(bridgeUuid)));
transaction.add(op.comment("Open_vSwitch: Mutating " + original.getBridgeName() + " " + bridgeUuid));
LOG.info("Bridge Deleted: {}", ovsdbManagedNodeIid);
} else {
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
String portNamedUuid = "Port_" + SouthboundMapper.getRandomUuid();
Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class);
port.setName(ovsdbManagedNode.getBridgeName().getValue());
- port.setInterfaces(Sets.newHashSet(TransactUtils.extractNamedUuid(interfaceInsert)));
+ port.setInterfaces(Collections.singleton(TransactUtils.extractNamedUuid(interfaceInsert)));
transaction.add(op.insert(port).withId(portNamedUuid));
- bridge.setPorts(Sets.newHashSet(new UUID(portNamedUuid)));
+ bridge.setPorts(Collections.singleton(new UUID(portNamedUuid)));
}
private Insert<GenericTableSchema> setInterface(TransactionBuilder transaction,
OvsdbBridgeAugmentation ovsdbManagedNode) {
if (ovsdbManagedNode.getFailMode() != null
&& SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode()) != null) {
- bridge.setFailMode(Sets.newHashSet(
+ bridge.setFailMode(Collections.singleton(
SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode())));
}
}
/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
if (ovsdbBridge != null && controllerEntryOptional.isPresent()) {
ControllerEntry controllerEntry = controllerEntryOptional.get();
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
- bridge.setController(Sets.newHashSet(new UUID(controllerEntry.getControllerUuid().getValue())));
+ bridge.setController(Collections.singleton(new UUID(controllerEntry.getControllerUuid().getValue())));
transaction.add(op.mutate(bridge).addMutation(bridge.getControllerColumn().getSchema(),
Mutator.DELETE, bridge.getControllerColumn().getData()));
}
/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright © 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Controller.class);
controller.setTarget(controllerEntry.getTarget().getValue());
if (controllerEntry.getMaxBackoff() != null) {
- controller.setMaxBackoff(Sets.newHashSet(controllerEntry.getMaxBackoff()));
+ controller.setMaxBackoff(Collections.singleton(controllerEntry.getMaxBackoff()));
}
if (controllerEntry.getInactivityProbe() != null) {
- controller.setInactivityProbe(Sets.newHashSet(controllerEntry.getInactivityProbe()));
+ controller.setInactivityProbe(Collections.singleton(controllerEntry.getInactivityProbe()));
}
String controllerNamedUuidString = SouthboundMapper.getRandomUuid();
UUID controllerNamedUuid = new UUID(controllerNamedUuidString);
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
bridge.setName(ovsdbBridge.getBridgeName().getValue());
- bridge.setController(Sets.newHashSet(controllerNamedUuid));
+ bridge.setController(Collections.singleton(controllerNamedUuid));
LOG.trace("Added controller : {} for bridge : {}",
controller.getTargetColumn(), bridge.getName());
transaction.add(op.mutate(bridge)
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
List<Insert> inserts = TransactUtils.extractInsert(transaction, bridge.getSchema());
for (Insert insert : inserts) {
OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
- ovs.setBridges(Sets.newHashSet(TransactUtils.extractNamedUuid(insert)));
+ ovs.setBridges(Collections.singleton(TransactUtils.extractNamedUuid(insert)));
transaction.add(op.mutate(ovs).addMutation(ovs.getBridgesColumn().getSchema(),
Mutator.INSERT,
ovs.getBridgesColumn().getData()));
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
String protocolString = SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocolEntry.getProtocol());
if (protocolString != null) {
- bridge.setProtocols(Sets.newHashSet(protocolString));
+ bridge.setProtocols(Collections.singleton(protocolString));
try {
transaction.add(op.mutate(bridge).addMutation(bridge.getProtocolsColumn().getSchema(),
Mutator.DELETE,bridge.getProtocolsColumn().getData()));
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
bridge.setName(ovsdbBridge.getBridgeName().getValue());
try {
- bridge.setProtocols(Sets.newHashSet(protocolString));
+ bridge.setProtocols(Collections.singleton(protocolString));
transaction.add(op.mutate(bridge).addMutation(bridge.getProtocolsColumn().getSchema(),
Mutator.INSERT,bridge.getProtocolsColumn().getData())
.where(bridge.getNameColumn().getSchema().opEqual(bridge.getNameColumn().getData()))
import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Collection;
import java.util.Collections;
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
if (getBridge(entry.getKey(), nodes) != null) {
bridge.setName(getBridge(entry.getKey(), nodes).getBridgeName().getValue());
- bridge.setPorts(Sets.newHashSet(new UUID(portUuid)));
+ bridge.setPorts(Collections.singleton(new UUID(portUuid)));
transaction.add(op.mutate(bridge)
.addMutation(bridge.getPortsColumn().getSchema(),
final Port port, final String interfaceUuid) {
port.setName(terminationPoint.getName());
- port.setInterfaces(Sets.newHashSet(new UUID(interfaceUuid)));
+ port.setInterfaces(Collections.singleton(new UUID(interfaceUuid)));
createPortOtherConfig(terminationPoint, port);
createPortVlanTag(terminationPoint, port);
createPortVlanTrunk(terminationPoint, port);
Long ofPort = terminationPoint.getOfport();
if (ofPort != null) {
- ovsInterface.setOpenFlowPort(Sets.newHashSet(ofPort));
+ ovsInterface.setOpenFlowPort(Collections.singleton(ofPort));
}
}
Integer ofPortRequest = terminationPoint.getOfportRequest();
if (ofPortRequest != null) {
- ovsInterface.setOpenFlowPortRequest(Sets.newHashSet(ofPortRequest.longValue()));
+ ovsInterface.setOpenFlowPortRequest(Collections.singleton(ofPortRequest.longValue()));
}
}
/*
- * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
transaction.add(op.mutate(bridge.getSchema())
.addMutation(bridge.getPortsColumn().getSchema(),
- Mutator.DELETE, Sets.newHashSet(portUuid))
+ Mutator.DELETE, Collections.singleton(portUuid))
.where(bridge.getNameColumn().getSchema().opEqual(bridgeName)).build());
transaction.add(op.comment("Bridge: Mutating " + bridgeName
/*
- * Copyright (c) 2015, 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ * Copyright © 2015, 2017 Brocade Communications Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
final Port port,
final OvsdbBridgeAugmentation operBridge) {
- Set<UUID> uuidSet = Sets.newHashSet();
+ Set<UUID> uuidSet = new HashSet<>();
// First check if QosEntry is present and use that
if (terminationPoint.getQosEntry() != null && !terminationPoint.getQosEntry().isEmpty()) {
Long ofPort = terminationPoint.getOfport();
if (ofPort != null) {
- ovsInterface.setOpenFlowPort(Sets.newHashSet(ofPort));
+ ovsInterface.setOpenFlowPort(Collections.singleton(ofPort));
}
}
Integer ofPortRequest = terminationPoint.getOfportRequest();
if (ofPortRequest != null) {
- ovsInterface.setOpenFlowPortRequest(Sets.newHashSet(ofPortRequest.longValue()));
+ ovsInterface.setOpenFlowPortRequest(Collections.singleton(ofPortRequest.longValue()));
}
}
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
externalIdsMap);
Mutation deleteIidMutation = new Mutation(columnSchema.getName(),
Mutator.DELETE,
- OvsdbSet.fromSet(Sets.newHashSet(SouthboundConstants.IID_EXTERNAL_ID_KEY)));
- List<Mutation> mutations = Lists.newArrayList(Sets.newHashSet(deleteIidMutation));
+ OvsdbSet.fromSet(Collections.singleton(SouthboundConstants.IID_EXTERNAL_ID_KEY)));
+ List<Mutation> mutations = new ArrayList<>();
+ mutations.add(deleteIidMutation);
mutations.addAll(mutate.getMutations());
mutate.setMutations(mutations);
return mutate;
entry.addAugmentation(
OvsdbTerminationPointAugmentation.class,
ovsdbTerminationPointAugmentationBuilder.build());
- portNodeBuilder.setTerminationPoint(Lists.newArrayList(entry.build()));
+ portNodeBuilder.setTerminationPoint(Collections.singletonList(entry.build()));
boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
portIid, portNodeBuilder.build());
Thread.sleep(OVSDB_UPDATE_TIMEOUT);
tpUpdateBuilder.addAugmentation(
OvsdbTerminationPointAugmentation.class,
tpUpdateAugmentationBuilder.build());
- portUpdateNodeBuilder.setTerminationPoint(Lists.newArrayList(tpUpdateBuilder.build()));
+ portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build()));
Assert.assertTrue(mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
portIid, portUpdateNodeBuilder.build()));
Thread.sleep(OVSDB_UPDATE_TIMEOUT);
OvsdbTerminationPointAugmentation.class,
tpUpdateAugmentationBuilder.build());
tpUpdateBuilder.setTpId(new TpId(portName));
- portUpdateNodeBuilder.setTerminationPoint(Lists.newArrayList(tpUpdateBuilder.build()));
+ portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build()));
Assert.assertTrue(
mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build()));
Thread.sleep(OVSDB_UPDATE_TIMEOUT);
OvsdbTerminationPointAugmentation.class,
tpUpdateAugmentationBuilder.build());
tpUpdateBuilder.setTpId(new TpId(portName));
- portUpdateNodeBuilder.setTerminationPoint(Lists.newArrayList(tpUpdateBuilder.build()));
+ portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build()));
Assert.assertTrue(
mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build()));
Thread.sleep(OVSDB_UPDATE_TIMEOUT);
int max = 4095;
return Lists.newArrayList(
Collections.<Integer>emptySet(),
- Sets.newHashSet(2222),
+ Collections.singleton(2222),
Sets.newHashSet(min, max, min + 1, max - 1, (max - min) / 2));
}
private List<Trunks> buildTrunkList(Set<Integer> trunkSet) {
- List<Trunks> trunkList = Lists.newArrayList();
+ List<Trunks> trunkList = new ArrayList<>();
for (Integer trunk : trunkSet) {
TrunksBuilder trunkBuilder = new TrunksBuilder();
trunkBuilder.setTrunk(new VlanId(trunk));
@Test
public void testCRUDTerminationPointVlanTrunks() throws InterruptedException {
- final List<Trunks> UPDATED_TRUNKS = buildTrunkList(Sets.newHashSet(2011));
+ final List<Trunks> UPDATED_TRUNKS = buildTrunkList(Collections.singleton(2011));
ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
Iterable<Set<Integer>> vlanSets = generateVlanSets();
int testCase = 0;
OvsdbTerminationPointAugmentation.class,
tpUpdateAugmentationBuilder.build());
tpUpdateBuilder.setTpId(new TpId(portName));
- portUpdateNodeBuilder.setTerminationPoint(Lists.newArrayList(tpUpdateBuilder.build()));
+ portUpdateNodeBuilder.setTerminationPoint(Collections.singletonList(tpUpdateBuilder.build()));
Assert.assertTrue(
mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, portIid, portUpdateNodeBuilder.build()));
Thread.sleep(OVSDB_UPDATE_TIMEOUT);