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 };
}
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();
}
Aggregations