Search in sources :

Example 11 with OvsdbMap

use of org.onosproject.ovsdb.rfc.notation.OvsdbMap in project onos by opennetworkinglab.

the class OvsdbControllerImpl method getMacAndIfaceid.

/**
 * Gets mac and iface from the table Interface.
 *
 * @param intf Interface instance
 * @return attachedMac, ifaceid
 */
private String[] getMacAndIfaceid(Interface intf) {
    OvsdbMap ovsdbMap = (OvsdbMap) intf.getExternalIdsColumn().data();
    @SuppressWarnings("unchecked") Map<String, String> externalIds = ovsdbMap.map();
    if (externalIds == null) {
        log.warn("The external_ids is null");
        return null;
    }
    String attachedMac = externalIds.get(OvsdbConstant.EXTERNAL_ID_VM_MAC);
    if (attachedMac == null) {
        // FIXME why always null?
        log.debug("The attachedMac is null");
        return null;
    }
    String ifaceid = externalIds.get(OvsdbConstant.EXTERNAL_ID_INTERFACE_ID);
    if (ifaceid == null) {
        log.warn("The ifaceid is null");
        return null;
    }
    return new String[] { attachedMac, ifaceid };
}
Also used : OvsdbMap(org.onosproject.ovsdb.rfc.notation.OvsdbMap)

Example 12 with OvsdbMap

use of org.onosproject.ovsdb.rfc.notation.OvsdbMap in project onos by opennetworkinglab.

the class OvsdbMapSerializer method serialize.

@Override
public void serialize(OvsdbMap map, JsonGenerator generator, SerializerProvider provider) throws IOException, JsonProcessingException {
    generator.writeStartArray();
    generator.writeString("map");
    generator.writeStartArray();
    Map javaMap = map.map();
    for (Object key : javaMap.keySet()) {
        generator.writeStartArray();
        generator.writeObject(key);
        generator.writeObject(javaMap.get(key));
        generator.writeEndArray();
    }
    generator.writeEndArray();
    generator.writeEndArray();
}
Also used : OvsdbMap(org.onosproject.ovsdb.rfc.notation.OvsdbMap) Map(java.util.Map)

Aggregations

OvsdbMap (org.onosproject.ovsdb.rfc.notation.OvsdbMap)12 OvsdbRowStore (org.onosproject.ovsdb.controller.OvsdbRowStore)7 Row (org.onosproject.ovsdb.rfc.notation.Row)7 Uuid (org.onosproject.ovsdb.rfc.notation.Uuid)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 DatabaseSchema (org.onosproject.ovsdb.rfc.schema.DatabaseSchema)5 ConcurrentMap (java.util.concurrent.ConcurrentMap)3 Operation (org.onosproject.ovsdb.rfc.operations.Operation)3 Set (java.util.Set)2 OvsdbPort (org.onosproject.ovsdb.controller.OvsdbPort)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Lists (com.google.common.collect.Lists)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Dictionary (java.util.Dictionary)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Objects (java.util.Objects)1