@Test
public void testDBLookup() {
ModelDatabase db = new ModelDatabase();
NetworkVO network = Mockito.mock(NetworkVO.class);
VirtualNetworkModel storageModel = new VirtualNetworkModel(network, null, ContrailManager.managementNetworkName,
TrafficType.Storage);
db.getVirtualNetworks().add(storageModel);
VirtualNetworkModel mgmtModel = new VirtualNetworkModel(network, null, ContrailManager.managementNetworkName,
TrafficType.Management);
db.getVirtualNetworks().add(mgmtModel);
VirtualNetworkModel guestModel1 = new VirtualNetworkModel(network, UUID.randomUUID().toString(), "test",
TrafficType.Guest);
db.getVirtualNetworks().add(guestModel1);
VirtualNetworkModel guestModel2 = new VirtualNetworkModel(network, UUID.randomUUID().toString(), "test",
TrafficType.Guest);
db.getVirtualNetworks().add(guestModel2);
s_logger.debug("networks: " + db.getVirtualNetworks().size());
assertEquals(4, db.getVirtualNetworks().size());
assertSame(storageModel, db.lookupVirtualNetwork(null, storageModel.getName(), TrafficType.Storage));
assertSame(mgmtModel, db.lookupVirtualNetwork(null, mgmtModel.getName(), TrafficType.Management));
assertSame(guestModel1, db.lookupVirtualNetwork(guestModel1.getUuid(), null, TrafficType.Guest));
assertSame(guestModel2, db.lookupVirtualNetwork(guestModel2.getUuid(), null, TrafficType.Guest));
}