import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbQosRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntriesKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIdsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceLldp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceLldpKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceOtherConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceOtherConfigsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIds;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Trunks;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
// First check if QosEntry is present and use that
if (terminationPoint.getQosEntry() != null && !terminationPoint.getQosEntry().isEmpty()) {
- OvsdbQosRef qosRef = terminationPoint.getQosEntry().iterator().next().getQosRef();
+ OvsdbQosRef qosRef = terminationPoint.getQosEntry().values().iterator().next().getQosRef();
Uri qosId = qosRef.getValue().firstKeyOf(QosEntries.class).getQosId();
OvsdbNodeAugmentation operNode = getOperNode(operBridge);
- if (operNode != null && operNode.getQosEntries() != null
- && !operNode.getQosEntries().isEmpty()) {
- for (QosEntries qosEntry : operNode.getQosEntries()) {
- if (qosEntry.getQosId().equals(qosId)) {
+ if (operNode != null) {
+ Map<QosEntriesKey, QosEntries> entries = operNode.getQosEntries();
+ if (entries != null) {
+ QosEntries qosEntry = entries.get(new QosEntriesKey(qosId));
+ if (qosEntry != null) {
uuidSet.add(new UUID(qosEntry.getQosUuid().getValue()));
}
}
private static void updateInterfaceExternalIds(final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
- List<InterfaceExternalIds> interfaceExternalIds =
+ Map<InterfaceExternalIdsKey, InterfaceExternalIds> interfaceExternalIds =
terminationPoint.getInterfaceExternalIds();
+ final InterfaceExternalIds odl = SouthboundUtil.interfaceCreatedByOpenDaylight();
+
if (interfaceExternalIds != null && !interfaceExternalIds.isEmpty()) {
- interfaceExternalIds.add(SouthboundUtil.createExternalIdsForInterface(
- SouthboundConstants.CREATED_BY, SouthboundConstants.ODL));
+ interfaceExternalIds.put(odl.key(), odl);
} else {
- interfaceExternalIds = Arrays.asList(SouthboundUtil.createExternalIdsForInterface(
- SouthboundConstants.CREATED_BY, SouthboundConstants.ODL));
+ interfaceExternalIds = Map.of(odl.key(), odl);
}
try {
ovsInterface.setExternalIds(YangUtils.convertYangKeyValueListToMap(interfaceExternalIds,
private static void updateInterfaceLldp(final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
try {
- List<InterfaceLldp> interfaceLldpList =
+ Map<InterfaceLldpKey, InterfaceLldp> interfaceLldpList =
terminationPoint.getInterfaceLldp();
if (interfaceLldpList != null && !interfaceLldpList.isEmpty()) {
try {
private static void updateInterfaceOtherConfig(final OvsdbTerminationPointAugmentation terminationPoint,
final Interface ovsInterface) {
- List<InterfaceOtherConfigs> interfaceOtherConfigs =
+ Map<InterfaceOtherConfigsKey, InterfaceOtherConfigs> interfaceOtherConfigs =
terminationPoint.getInterfaceOtherConfigs();
if (interfaceOtherConfigs != null && !interfaceOtherConfigs.isEmpty()) {
Map<String, String> otherConfigsMap = new HashMap<>();
- for (InterfaceOtherConfigs interfaceOtherConfig : interfaceOtherConfigs) {
+ for (InterfaceOtherConfigs interfaceOtherConfig : interfaceOtherConfigs.values()) {
otherConfigsMap.put(interfaceOtherConfig.getOtherConfigKey(),
interfaceOtherConfig.getOtherConfigValue());
}
final Interface ovsInterface) {
try {
- List<InterfaceBfd> interfaceBfdList =
- terminationPoint.getInterfaceBfd();
+ Map<InterfaceBfdKey, InterfaceBfd> interfaceBfdList = terminationPoint.getInterfaceBfd();
if (interfaceBfdList != null && !interfaceBfdList.isEmpty()) {
try {
ovsInterface.setBfd(YangUtils.convertYangKeyValueListToMap(interfaceBfdList,
private static void updatePortOtherConfig(final OvsdbTerminationPointAugmentation terminationPoint,
final Port ovsPort) {
- List<PortOtherConfigs> portOtherConfigs =
+ Map<PortOtherConfigsKey, PortOtherConfigs> portOtherConfigs =
terminationPoint.getPortOtherConfigs();
if (portOtherConfigs != null && !portOtherConfigs.isEmpty()) {
try {