import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.QosTypeLinuxHfsc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.QosTypeLinuxHtb;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.QosTypeLinuxSfq;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.QosEntryKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yangtools.yang.common.Uint32;
public interface SouthboundConstants {
String TP_URI_PREFIX = "terminationpoint";
String QOS_URI_PREFIX = "qos";
String QOS_NAMED_UUID_PREFIX = "QOS";
- Integer PORT_QOS_LIST_KEY = 1;
+ QosEntryKey PORT_QOS_LIST_KEY = new QosEntryKey(Uint32.ONE);
String QUEUE_URI_PREFIX = "queue";
String QUEUE_NAMED_UUID_PREFIX = "QUEUE";
String AUTOATTACH_URI_PREFIX = "autoattach";
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if (controller.getMaxBackoffColumn() != null && controller.getMaxBackoffColumn().getData() != null
&& !controller.getMaxBackoffColumn().getData().isEmpty()) {
- builder.setMaxBackoff(controller.getMaxBackoffColumn().getData().iterator().next());
+ builder.setMaxBackoff(Uint32.valueOf(controller.getMaxBackoffColumn().getData().iterator().next()));
}
if (controller.getInactivityProbeColumn() != null && controller.getInactivityProbeColumn().getData() != null
&& !controller.getInactivityProbeColumn().getData().isEmpty()) {
- builder.setInactivityProbe(controller.getInactivityProbeColumn().getData().iterator().next());
+ builder.setInactivityProbe(
+ Uint32.valueOf(controller.getInactivityProbeColumn().getData().iterator().next()));
}
controllerEntries.add(builder
.setTarget(new Uri(targetString))
public static ConnectionInfo createConnectionInfo(final OvsdbClient client) {
ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder();
connectionInfoBuilder.setRemoteIp(createIpAddress(client.getConnectionInfo().getRemoteAddress()));
- connectionInfoBuilder.setRemotePort(new PortNumber(client.getConnectionInfo().getRemotePort()));
+ connectionInfoBuilder.setRemotePort(new PortNumber(Uint16.valueOf(client.getConnectionInfo().getRemotePort())));
connectionInfoBuilder.setLocalIp(createIpAddress(client.getConnectionInfo().getLocalAddress()));
- connectionInfoBuilder.setLocalPort(new PortNumber(client.getConnectionInfo().getLocalPort()));
+ connectionInfoBuilder.setLocalPort(new PortNumber(Uint16.valueOf(client.getConnectionInfo().getLocalPort())));
return connectionInfoBuilder.build();
}
final Manager manager) {
if (manager != null && manager.getTargetColumn() != null) {
- long numberOfConnections = 0;
+ Uint32 numberOfConnections = Uint32.ZERO;
final String targetString = manager.getTargetColumn().getData();
final Map<String, String> statusAttributeMap =
manager.getStatusColumn() == null ? null : manager.getStatusColumn().getData();
if (statusAttributeMap != null && statusAttributeMap.containsKey(N_CONNECTIONS_STR)) {
String numberOfConnectionValueStr = statusAttributeMap.get(N_CONNECTIONS_STR);
- numberOfConnections = Integer.parseInt(numberOfConnectionValueStr);
+ numberOfConnections = Uint32.valueOf(numberOfConnectionValueStr);
} else {
final boolean isConnected = manager.getIsConnectedColumn().getData();
if (isConnected) {
- numberOfConnections = 1;
+ numberOfConnections = Uint32.ONE;
}
}
managerEntries.add(new ManagerEntryBuilder()
*/
package org.opendaylight.ovsdb.southbound.transactions.md;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.autoattach.MappingsKey;
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;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static void setMappings(AutoattachBuilder autoAttachBuilder,
AutoAttach autoAttach) {
- final Map<Long, Long> mappings = autoAttach.getMappingsColumn().getData();
- final List<Mappings> mappingsList = new ArrayList<>();
- for (final Entry<Long, Long> entry : mappings.entrySet()) {
+ final Map<MappingsKey, Mappings> mappings = new LinkedHashMap<>();
+ for (final Entry<Long, Long> entry : autoAttach.getMappingsColumn().getData().entrySet()) {
final Long mappingsKey = entry.getKey();
- final Integer mappingsValue = Integer.valueOf(entry.getValue().intValue());
if (mappingsKey != null) {
- mappingsList.add(new MappingsBuilder()
- .withKey(new MappingsKey(mappingsKey))
- .setMappingsKey(mappingsKey)
- .setMappingsValue(mappingsValue)
- .build());
+ final MappingsKey key = new MappingsKey(Uint32.valueOf(mappingsKey));
+ mappings.put(key, new MappingsBuilder()
+ .withKey(key)
+ .setMappingsValue(Uint16.valueOf(entry.getValue().intValue()))
+ .build());
}
- autoAttachBuilder.setMappings(mappingsList);
+ autoAttachBuilder.setMappings(mappings);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.QosEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.QosEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.QosEntryKey;
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.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.TrunksBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Iterator<Long> itr = vlanId.iterator();
// There are no loops here, just get the first element.
int id = itr.next().intValue();
- ovsdbTerminationPointBuilder.setVlanTag(new VlanId(id));
+ ovsdbTerminationPointBuilder.setVlanTag(new VlanId(Uint16.valueOf(id)));
}
}
for (Long trunk: portTrunks) {
if (trunk != null) {
modelTrunks.add(new TrunksBuilder()
- .setTrunk(new VlanId(trunk.intValue())).build());
+ .setTrunk(new VlanId(Uint16.valueOf(trunk.intValue()))).build());
}
}
}
if (oldQosIid != null) {
InstanceIdentifier<QosEntry> oldPortQosIid = tpPath
.augmentation(OvsdbTerminationPointAugmentation.class)
- .child(QosEntry.class,
- new QosEntryKey(Long.valueOf(SouthboundConstants.PORT_QOS_LIST_KEY)));
+ .child(QosEntry.class, SouthboundConstants.PORT_QOS_LIST_KEY);
transaction.delete(LogicalDatastoreType.OPERATIONAL, oldPortQosIid);
}
}
InstanceIdentifier<QosEntries> qosIid = getQosIid(nodeId, ovsdbNode, qosUuid);
if (qosIid != null) {
- List<QosEntry> qosList = new ArrayList<>();
- OvsdbQosRef qosRef = new OvsdbQosRef(qosIid);
- qosList.add(new QosEntryBuilder()
- .withKey(new QosEntryKey(Long.valueOf(SouthboundConstants.PORT_QOS_LIST_KEY)))
- .setQosRef(qosRef).build());
- ovsdbTerminationPointBuilder.setQosEntry(qosList);
+ ovsdbTerminationPointBuilder.setQosEntry(
+ Map.of(SouthboundConstants.PORT_QOS_LIST_KEY, new QosEntryBuilder()
+ .withKey(SouthboundConstants.PORT_QOS_LIST_KEY)
+ .setQosRef(new OvsdbQosRef(qosIid))
+ .build()));
}
}
}
}
if (ifIndexSet != null && !ifIndexSet.isEmpty()) {
for (Long ifIndex : ifIndexSet) {
- ovsdbTerminationPointBuilder.setIfindex(ifIndex);
+ ovsdbTerminationPointBuilder.setIfindex(Uint32.valueOf(ifIndex));
}
}
} catch (SchemaVersionMismatchException e) {
Iterator<Long> ofPortsIter = ofPorts.iterator();
long ofPort = ofPortsIter.next();
if (ofPort >= 0) {
- ovsdbTerminationPointBuilder
- .setOfport(ofPort);
+ ovsdbTerminationPointBuilder.setOfport(Uint32.valueOf(ofPort));
} else {
- LOG.debug("Received negative value for ofPort from ovsdb for {} {}",
- interf.getName(),ofPort);
+ LOG.debug("Received negative value for ofPort from ovsdb for {} {}", interf.getName(),ofPort);
}
}
}
Iterator<Long> ofPortRequestsIter = ofPortRequests.iterator();
int ofPort = ofPortRequestsIter.next().intValue();
if (ofPort >= 0) {
- ovsdbTerminationPointBuilder
- .setOfportRequest(ofPort);
+ ovsdbTerminationPointBuilder.setOfportRequest(Uint16.valueOf(ofPort));
} else {
- LOG.debug("Received negative value for ofPort from ovsdb for {} {}",
- interf.getName(),ofPort);
+ LOG.debug("Received negative value for ofPort from ovsdb for {} {}", interf.getName(),ofPort);
}
}
}
if (ingressPolicingRate != null) {
if (ingressPolicingRate >= 0) {
ovsdbTerminationPointBuilder
- .setIngressPolicingRate(ingressPolicingRate);
+ .setIngressPolicingRate(Uint32.valueOf(ingressPolicingRate));
} else {
LOG.debug("Received negative value for ingressPolicingRate from ovsdb for {} {}",
interf.getName(),ingressPolicingRate);
if (ingressPolicingBurst != null) {
if (ingressPolicingBurst >= 0) {
ovsdbTerminationPointBuilder
- .setIngressPolicingBurst(ingressPolicingBurst);
+ .setIngressPolicingBurst(Uint32.valueOf(ingressPolicingBurst));
} else {
LOG.debug("Received negative value for ingressPolicingBurst from ovsdb for {} {}",
interf.getName(),ingressPolicingBurst);
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;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Collection<Long> queueListKeys = oldQueueList.keySet();
for (Long queueListKey : queueListKeys) {
KeyedInstanceIdentifier<QueueList, QueueListKey> otherIId =
- qosIId.child(QueueList.class, new QueueListKey(Long.valueOf(queueListKey.toString())));
+ qosIId.child(QueueList.class, new QueueListKey(Uint32.valueOf(queueListKey)));
transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId);
}
}
if (queueIid != null) {
newQueueList.add(
new QueueListBuilder()
- .setQueueNumber(queueEntry.getKey())
+ .setQueueNumber(Uint32.valueOf(queueEntry.getKey()))
.setQueueRef(new OvsdbQueueRef(queueIid)).build());
}
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;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
queuesBuilder.setQueueUuid(new Uuid(entry.getKey().toString()));
Collection<Long> dscp = queue.getDscpColumn().getData();
if (!dscp.isEmpty()) {
- queuesBuilder.setDscp(dscp.iterator().next().shortValue());
+ queuesBuilder.setDscp(Uint8.valueOf(dscp.iterator().next().shortValue()));
}
Queue oldQueue = oldQueueRows.get(entry.getKey());
setOtherConfig(transaction, queuesBuilder, oldQueue, queue, nodeIId);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
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;
+import org.opendaylight.yangtools.yang.common.Uint16;
/**
* Unit tests for the data-tree change listener.
InetAddress inetAddress = InetAddress.getByName("127.0.0.1");
int port = 6640;
IpAddress ipAddress = SouthboundMapper.createIpAddress(inetAddress);
- PortNumber portNumber = new PortNumber(port);
+ PortNumber portNumber = new PortNumber(Uint16.valueOf(port));
final ConnectionInfo connectionInfo = new ConnectionInfoBuilder()
.setRemoteIp(ipAddress)
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
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;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class SouthboundMapperTest {
assertEquals(Collections.singletonList(new ManagerEntryBuilder()
.setConnected(true)
- .setNumberOfConnections(999L)
+ .setNumberOfConnections(Uint32.valueOf(999))
.setTarget(Uri.getDefaultInstance("dummy"))
.build()), SouthboundMapper.createManagerEntries(ovsdbNode, updatedManagerRows));
statusAttributeMap.remove("n_connections");
assertEquals(Collections.singletonList(new ManagerEntryBuilder()
.setConnected(true)
- .setNumberOfConnections(1L)
+ .setNumberOfConnections(Uint32.ONE)
.setTarget(Uri.getDefaultInstance("dummy"))
.build()), SouthboundMapper.createManagerEntries(ovsdbNode, updatedManagerRows));
}
assertEquals(Collections.singletonList(new ManagerEntryBuilder()
.setConnected(true)
- .setNumberOfConnections(999L)
+ .setNumberOfConnections(Uint32.valueOf(999))
.setTarget(Uri.getDefaultInstance("dummy"))
.build()), SouthboundMapper.createManagerEntries(ovsdbNode, updatedManagerRows));
statusAttributeMap.remove("n_connections");
assertEquals(Collections.singletonList(new ManagerEntryBuilder()
.setConnected(true)
- .setNumberOfConnections(1L)
+ .setNumberOfConnections(Uint32.ONE)
.setTarget(Uri.getDefaultInstance("dummy"))
.build()), SouthboundMapper.createManagerEntries(ovsdbNode, updatedManagerRows));
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.api.support.membermodification.MemberMatcher;
import org.powermock.api.support.membermodification.MemberModifier;
when(column.getData()).thenReturn(ofPorts);
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder = mock(
OvsdbTerminationPointAugmentationBuilder.class);
- when(ovsdbTerminationPointBuilder.setOfport(any(Long.class))).thenReturn(ovsdbTerminationPointBuilder);
+ when(ovsdbTerminationPointBuilder.setOfport(any(Uint32.class))).thenReturn(ovsdbTerminationPointBuilder);
when(interf.getName()).thenReturn(INTERFACE_NAME);
Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updateOfPort", interf, ovsdbTerminationPointBuilder);
- verify(ovsdbTerminationPointBuilder).setOfport(any(Long.class));
+ verify(ovsdbTerminationPointBuilder).setOfport(any(Uint32.class));
}
@SuppressWarnings("unchecked")
when(column.getData()).thenReturn(ofPortRequests);
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder = mock(
OvsdbTerminationPointAugmentationBuilder.class);
- when(ovsdbTerminationPointBuilder.setOfportRequest(any(Integer.class)))
+ when(ovsdbTerminationPointBuilder.setOfportRequest(any(Uint16.class)))
.thenReturn(ovsdbTerminationPointBuilder);
when(interf.getName()).thenReturn(INTERFACE_NAME);
Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updateOfPortRequest", interf, ovsdbTerminationPointBuilder);
- verify(ovsdbTerminationPointBuilder).setOfportRequest(any(Integer.class));
+ verify(ovsdbTerminationPointBuilder).setOfportRequest(any(Uint16.class));
}
@SuppressWarnings("unchecked")