use of org.onosproject.ovsdb.rfc.table.Queue in project onos by opennetworkinglab.
the class DefaultOvsdbClient method getOvsdbQueue.
private OvsdbQueue getOvsdbQueue(Row row) {
DatabaseSchema dbSchema = getDatabaseSchema(DATABASENAME);
Queue queue = (Queue) TableGenerator.getTable(dbSchema, row, OvsdbTable.QUEUE);
if (queue == null) {
return null;
}
OvsdbSet dscpOvsdbSet = ((OvsdbSet) queue.getDscpColumn().data());
Set dscpSet = dscpOvsdbSet.set();
Long dscp = null;
if (dscpSet != null && !dscpSet.isEmpty()) {
dscp = Long.valueOf(dscpSet.toArray()[0].toString());
}
Map<String, String> otherConfigs;
Map<String, String> externalIds;
otherConfigs = ((OvsdbMap) queue.getOtherConfigColumn().data()).map();
externalIds = ((OvsdbMap) queue.getExternalIdsColumn().data()).map();
return OvsdbQueue.builder().dscp(dscp).otherConfigs(otherConfigs).externalIds(externalIds).build();
}
use of org.onosproject.ovsdb.rfc.table.Queue in project onos by opennetworkinglab.
the class DefaultOvsdbClient method createQueue.
@Override
public boolean createQueue(OvsdbQueue ovsdbQueue) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
Queue queue = (Queue) TableGenerator.createTable(dbSchema, OvsdbTable.QUEUE);
ArrayList<Operation> operations = Lists.newArrayList();
OvsdbRowStore rowStore = getRowStore(DATABASENAME, QUEUE);
if (rowStore == null) {
log.debug("The queue uuid is null");
return false;
}
if (ovsdbQueue.dscp().isPresent()) {
queue.setDscp(ImmutableSet.of(ovsdbQueue.dscp().get()));
}
queue.setOtherConfig(ovsdbQueue.otherConfigs());
queue.setExternalIds(ovsdbQueue.externalIds());
Insert queueInsert = new Insert(dbSchema.getTableSchema(QUEUE), QUEUE, queue.getRow());
operations.add(queueInsert);
try {
transactConfig(DATABASENAME, operations).get();
} catch (InterruptedException | ExecutionException e) {
log.error("createQueue transactConfig get exception !");
}
return true;
}
Aggregations