Search in sources :

Example 1 with Queue

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();
}
Also used : OvsdbSet(org.onosproject.ovsdb.rfc.notation.OvsdbSet) Set(java.util.Set) ImmutableSet(com.google.common.collect.ImmutableSet) HashSet(java.util.HashSet) OvsdbSet(org.onosproject.ovsdb.rfc.notation.OvsdbSet) OvsdbQueue(org.onosproject.ovsdb.controller.OvsdbQueue) Queue(org.onosproject.ovsdb.rfc.table.Queue) DatabaseSchema(org.onosproject.ovsdb.rfc.schema.DatabaseSchema)

Example 2 with Queue

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;
}
Also used : Operation(org.onosproject.ovsdb.rfc.operations.Operation) OvsdbRowStore(org.onosproject.ovsdb.controller.OvsdbRowStore) Insert(org.onosproject.ovsdb.rfc.operations.Insert) ExecutionException(java.util.concurrent.ExecutionException) OvsdbQueue(org.onosproject.ovsdb.controller.OvsdbQueue) Queue(org.onosproject.ovsdb.rfc.table.Queue) DatabaseSchema(org.onosproject.ovsdb.rfc.schema.DatabaseSchema)

Aggregations

OvsdbQueue (org.onosproject.ovsdb.controller.OvsdbQueue)2 DatabaseSchema (org.onosproject.ovsdb.rfc.schema.DatabaseSchema)2 Queue (org.onosproject.ovsdb.rfc.table.Queue)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ExecutionException (java.util.concurrent.ExecutionException)1 OvsdbRowStore (org.onosproject.ovsdb.controller.OvsdbRowStore)1 OvsdbSet (org.onosproject.ovsdb.rfc.notation.OvsdbSet)1 Insert (org.onosproject.ovsdb.rfc.operations.Insert)1 Operation (org.onosproject.ovsdb.rfc.operations.Operation)1