diff --git a/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
index 5cd5c3b..8665a4e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
@@ -59,7 +59,7 @@
         Region region = regionId == null ? null : regionService.getRegion(regionId(regionId));
         UiTopoLayoutId pid = parentId == null ? UiTopoLayoutId.DEFAULT_ID : layoutId(parentId);
 
-        UiTopoLayout layout = new UiTopoLayout(layoutId(id), region, pid);
+        UiTopoLayout layout = new UiTopoLayout(layoutId(id)).region(region).parent(pid);
         service.addLayout(layout);
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/config/basics/BasicUiTopoLayoutConfig.java b/core/api/src/main/java/org/onosproject/net/config/basics/BasicUiTopoLayoutConfig.java
index e75df69..4091f4e 100644
--- a/core/api/src/main/java/org/onosproject/net/config/basics/BasicUiTopoLayoutConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/config/basics/BasicUiTopoLayoutConfig.java
@@ -132,12 +132,12 @@
     /**
      * Sets the name of the geomap (topojson file) to use for this layout.
      *
-     * @param geomap geomap name
+     * @param geomap geomap name; null to clear
      * @return config for UI topology layout
      * @throws InvalidFieldException if the sprites field is already set
      */
     public BasicUiTopoLayoutConfig geomap(String geomap) {
-        if (hasField(SPRITES)) {
+        if (geomap != null && hasField(SPRITES)) {
             throw new InvalidFieldException(GEOMAP, E_SPRITES_ALREADY_SET);
         }
         setOrClear(GEOMAP, geomap);
@@ -156,12 +156,12 @@
     /**
      * Sets the name of the sprites definition to use for this layout.
      *
-     * @param sprites sprites definition name
+     * @param sprites sprites definition name; null to clear
      * @return config for UI topology layout
      * @throws InvalidFieldException if the geomap field is already set
      */
     public BasicUiTopoLayoutConfig sprites(String sprites) {
-        if (hasField(GEOMAP)) {
+        if (sprites != null && hasField(GEOMAP)) {
             throw new InvalidFieldException(GEOMAP, E_GEOMAP_ALREADY_SET);
         }
         setOrClear(SPRITES, sprites);
diff --git a/core/api/src/main/java/org/onosproject/ui/UiTopoLayoutService.java b/core/api/src/main/java/org/onosproject/ui/UiTopoLayoutService.java
index 3a42dac..8872087 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiTopoLayoutService.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiTopoLayoutService.java
@@ -37,7 +37,7 @@
     UiTopoLayout getRootLayout();
 
     /**
-     * Returns the set of available layouts.
+     * Returns the set of available layouts (not including the root layout).
      *
      * @return set of available layouts
      */
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiTopoLayout.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiTopoLayout.java
index ade86e1..b37f1df 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiTopoLayout.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiTopoLayout.java
@@ -16,36 +16,68 @@
 
 package org.onosproject.ui.model.topo;
 
+import com.google.common.base.MoreObjects;
 import org.onosproject.net.region.Region;
 import org.onosproject.net.region.RegionId;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * Represents a specific "subset" of the UI model of the network topology
  * that a user might wish to view. Backed by a {@link Region}.
+ * <p>
+ * These instances include information about which geo-map (or sprite definition)
+ * should be displayed, along with zoom and offset parameters.
  */
 public class UiTopoLayout {
 
+    // package private for unit test access
+    static final double SCALE_MIN = 0.01;
+    static final double SCALE_MAX = 100.0;
+    static final double SCALE_DEFAULT = 1.0;
+    static final double OFFSET_DEFAULT = 0.0;
+
+    static final String E_ROOT_PARENT = "Cannot change parent ID of root layout";
+    static final String E_ROOT_REGION = "Cannot set region on root layout";
+    static final String E_SPRITES_SET = "Cannot set geomap if sprites is set";
+    static final String E_GEOMAP_SET = "Cannot set sprites if geomap is set";
+    static final String E_SCALE_OOB =
+            "Scale out of bounds; expected [" + SCALE_MIN + ".." + SCALE_MAX + "]";
+
     private final UiTopoLayoutId id;
-    private final Region region;
-    private final UiTopoLayoutId parent;
+
+    private Region region;
+    private UiTopoLayoutId parent;
+    private String geomap;
+    private String sprites;
+    private double scale = SCALE_DEFAULT;
+    private double offsetX = OFFSET_DEFAULT;
+    private double offsetY = OFFSET_DEFAULT;
 
     /**
      * Created a new UI topology layout.
      *
-     * @param id     layout identifier
-     * @param region backing region
-     * @param parent identifier of the parent layout
+     * @param id layout identifier
      */
-    public UiTopoLayout(UiTopoLayoutId id, Region region, UiTopoLayoutId parent) {
+    public UiTopoLayout(UiTopoLayoutId id) {
+        checkNotNull(id, "layout ID cannot be null");
         this.id = id;
-        this.region = region;
+
         // NOTE: root layout is its own parent...
-        this.parent = parent != null ? parent : this.id;
+        if (isRoot()) {
+            parent = id;
+        }
     }
 
-    @Override
-    public String toString() {
-        return "{UiTopoLayout: " + id + "}";
+    /**
+     * Returns true if this layout instance is at the top of the
+     * hierarchy tree.
+     *
+     * @return true if this is the root layout
+     */
+    public boolean isRoot() {
+        return UiTopoLayoutId.DEFAULT_ID.equals(id);
     }
 
     /**
@@ -57,6 +89,37 @@
         return id;
     }
 
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .add("id", id)
+                .add("region", region)
+                .add("parent", parent)
+                .add("geomap", geomap)
+                .add("sprites", sprites)
+                .add("scale", scale)
+                .add("offsetX", offsetX)
+                .add("offsetY", offsetY)
+                .toString();
+    }
+
+    /**
+     * Sets the backing region for this layout. Note that an exception will
+     * be thrown if this is the root layout.
+     *
+     * @param region the backing region
+     * @return self, for chaining
+     * @throws IllegalArgumentException if this is the root layout
+     */
+    public UiTopoLayout region(Region region) {
+        if (isRoot()) {
+            throw new IllegalArgumentException(E_ROOT_REGION);
+        }
+
+        this.region = region;
+        return this;
+    }
+
     /**
      * Returns the backing region with which this layout is associated. Note
      * that this may be null (for the root layout).
@@ -76,8 +139,27 @@
      * @return backing region identifier
      */
     public RegionId regionId() {
-        return isRoot() ? UiRegion.NULL_ID
-                : (region == null ? null : region.id());
+        return isRoot() ? UiRegion.NULL_ID :
+                (region == null ? null : region.id());
+    }
+
+    /**
+     * Sets the identity of this layout's parent. May be null to unset.
+     * Note that an exception will be thrown if this is the root layout,
+     * since the parent of the root is always itself, and cannot be changed.
+     *
+     * @param parentId parent layout identifier
+     * @return self, for chaining
+     * @throws IllegalArgumentException if this instance is the root layout
+     */
+    public UiTopoLayout parent(UiTopoLayoutId parentId) {
+        if (isRoot()) {
+            throw new IllegalArgumentException(E_ROOT_PARENT);
+        }
+        // TODO: consider checking ancestry chain to prevent loops
+
+        parent = parentId;
+        return this;
     }
 
     /**
@@ -90,12 +172,129 @@
     }
 
     /**
-     * Returns true if this layout instance is at the top of the
-     * hierarchy tree.
+     * Sets the name of the geomap for this layout. This is the symbolic
+     * name for a "topojson" file containing a geographic map projection,
+     * to be displayed in the topology view, for this layout.
+     * <p>
+     * Since the geomap and sprites fields are mutually exclusive, this
+     * method will throw an exception if the sprites field is already set.
      *
-     * @return true if this is the root layout
+     * @param geomap the geomap name
+     * @return self, for chaining
+     * @throws IllegalArgumentException if the sprites field is not null
      */
-    public boolean isRoot() {
-        return id.equals(parent);
+    public UiTopoLayout geomap(String geomap) {
+        if (sprites != null) {
+            throw new IllegalArgumentException(E_SPRITES_SET);
+        }
+        this.geomap = geomap;
+        return this;
     }
+
+    /**
+     * Returns the symbolic name for the geomap for this layout.
+     *
+     * @return name of geomap
+     */
+    public String geomap() {
+        return geomap;
+    }
+
+    /**
+     * Sets the name of the sprites definition for this layout. This is the
+     * symbolic name for a "json" file containing a definition of sprites,
+     * which render as a symbolic background (e.g. a campus, or floor plan),
+     * to be displayed in the topology view, for this layout.
+     * <p>
+     * Since the geomap and sprites fields are mutually exclusive, this
+     * method will throw an exception if the geomap field is already set.
+     *
+     * @param sprites the sprites definition name
+     * @return self, for chaining
+     * @throws IllegalArgumentException if the geomap field is not null
+     */
+    public UiTopoLayout sprites(String sprites) {
+        if (geomap != null) {
+            throw new IllegalArgumentException(E_GEOMAP_SET);
+        }
+        this.sprites = sprites;
+        return this;
+    }
+
+    /**
+     * Returns the symbolic name for the sprites definition for this layout.
+     *
+     * @return name of sprites definition
+     */
+    public String sprites() {
+        return sprites;
+    }
+
+    private boolean scaleWithinBounds(double scale) {
+        return scale >= SCALE_MIN && scale <= SCALE_MAX;
+    }
+
+    /**
+     * Sets the scale for the geomap / sprite image. Note that the
+     * acceptable bounds are from {@value #SCALE_MIN} to {@value #SCALE_MAX}.
+     *
+     * @param scale the scale
+     * @return self for chaining
+     * @throws IllegalArgumentException if the value is out of bounds
+     */
+    public UiTopoLayout scale(double scale) {
+        checkArgument(scaleWithinBounds(scale), E_SCALE_OOB);
+        this.scale = scale;
+        return this;
+    }
+
+    /**
+     * Returns the scale for the geomap / sprite image.
+     *
+     * @return the scale
+     */
+    public double scale() {
+        return scale;
+    }
+
+    /**
+     * Sets the x-offset value.
+     *
+     * @param offsetX x-offset
+     * @return self, for chaining
+     */
+    public UiTopoLayout offsetX(double offsetX) {
+        this.offsetX = offsetX;
+        return this;
+    }
+
+    /**
+     * Returns the x-offset value.
+     *
+     * @return the x-offset
+     */
+    public double offsetX() {
+        return offsetX;
+    }
+
+    /**
+     * Sets the y-offset value.
+     *
+     * @param offsetY y-offset
+     * @return self, for chaining
+     */
+    public UiTopoLayout offsetY(double offsetY) {
+        this.offsetY = offsetY;
+        return this;
+    }
+
+    /**
+     * Returns the y-offset value.
+     *
+     * @return the y-offset
+     */
+    public double offsetY() {
+        return offsetY;
+    }
+
 }
diff --git a/core/api/src/test/java/org/onosproject/ui/model/topo/UiTopoLayoutTest.java b/core/api/src/test/java/org/onosproject/ui/model/topo/UiTopoLayoutTest.java
new file mode 100644
index 0000000..b8db969
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/ui/model/topo/UiTopoLayoutTest.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.ui.model.topo;
+
+import org.junit.Test;
+import org.onosproject.net.region.DefaultRegion;
+import org.onosproject.net.region.Region;
+import org.onosproject.net.region.RegionId;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.onosproject.net.region.Region.Type.CAMPUS;
+import static org.onosproject.net.region.RegionId.regionId;
+import static org.onosproject.ui.model.topo.UiTopoLayout.E_GEOMAP_SET;
+import static org.onosproject.ui.model.topo.UiTopoLayout.E_ROOT_PARENT;
+import static org.onosproject.ui.model.topo.UiTopoLayout.E_ROOT_REGION;
+import static org.onosproject.ui.model.topo.UiTopoLayout.E_SPRITES_SET;
+import static org.onosproject.ui.model.topo.UiTopoLayoutId.layoutId;
+
+/**
+ * Unit tests for {@link UiTopoLayout}.
+ */
+public class UiTopoLayoutTest {
+
+    private static final String AM_NOEX = "no exception thrown";
+    private static final String AM_WREXMSG = "wrong exception message";
+
+    private static final double DELTA = Double.MIN_VALUE * 2.0;
+
+    private static final UiTopoLayoutId OTHER_ID = layoutId("other-id");
+    private static final RegionId REGION_ID = regionId("some-region");
+    private static final Region REGION =
+            new DefaultRegion(REGION_ID, "Region-1", CAMPUS, null);
+    private static final String GEOMAP = "geo1";
+    private static final String SPRITE = "spr1";
+
+
+    private UiTopoLayout layout;
+
+    private void mkRootLayout() {
+        layout = new UiTopoLayout(UiTopoLayoutId.DEFAULT_ID);
+    }
+
+    private void mkOtherLayout() {
+        layout = new UiTopoLayout(OTHER_ID);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void nullIdentifier() {
+        layout = new UiTopoLayout(null);
+    }
+
+    @Test
+    public void rootLayout() {
+        mkRootLayout();
+        assertEquals("wrong id", UiTopoLayoutId.DEFAULT_ID, layout.id());
+        assertEquals("wrong parent (not self)",
+                UiTopoLayoutId.DEFAULT_ID, layout.parent());
+        assertTrue("should be root", layout.isRoot());
+
+        assertNull("unexpected region", layout.region());
+        assertEquals("unexpected region id", UiRegion.NULL_ID, layout.regionId());
+    }
+
+    @Test
+    public void otherLayout() {
+        mkOtherLayout();
+        assertEquals("wrong id", OTHER_ID, layout.id());
+        assertEquals("not null parent", null, layout.parent());
+        assertFalse("should NOT be root", layout.isRoot());
+
+        // check attribute default values...
+        assertNull("unexpected region", layout.region());
+        assertNull("unexpected region id", layout.regionId());
+        assertNull("unexpected geomap", layout.geomap());
+        assertNull("unexpected sprites", layout.sprites());
+        assertEquals("non-unity scale", 1.0, layout.scale(), DELTA);
+        assertEquals("non-zero x-off", 0.0, layout.offsetX(), DELTA);
+        assertEquals("non-zero y-off", 0.0, layout.offsetY(), DELTA);
+    }
+
+    @Test
+    public void setRegionOnRoot() {
+        mkRootLayout();
+        try {
+            layout.region(REGION);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_ROOT_REGION, e.getMessage());
+        }
+
+        try {
+            layout.region(null);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_ROOT_REGION, e.getMessage());
+        }
+    }
+
+    @Test
+    public void setRegionOnOther() {
+        mkOtherLayout();
+        layout.region(REGION);
+        assertEquals("wrong region", REGION, layout.region());
+        assertEquals("wrong region id", REGION_ID, layout.regionId());
+
+        layout.region(null);
+        assertEquals("non-null region", null, layout.region());
+        assertEquals("non-null region id", null, layout.regionId());
+    }
+
+    @Test
+    public void setParentOnRoot() {
+        mkRootLayout();
+        try {
+            layout.parent(OTHER_ID);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_ROOT_PARENT, e.getMessage());
+        }
+
+        try {
+            layout.parent(null);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_ROOT_PARENT, e.getMessage());
+        }
+    }
+
+    @Test
+    public void setParentOnOther() {
+        mkOtherLayout();
+        layout.parent(OTHER_ID);
+        assertEquals("wrong parent", OTHER_ID, layout.parent());
+
+        layout.parent(null);
+        assertEquals("non-null parent", null, layout.parent());
+    }
+
+    @Test
+    public void setGeomap() {
+        mkRootLayout();
+        assertEquals("geo to start", null, layout.geomap());
+        layout.geomap(GEOMAP);
+        assertEquals("wrong geo", GEOMAP, layout.geomap());
+    }
+
+    @Test
+    public void setGeomapAfterSprites() {
+        mkRootLayout();
+        layout.sprites(SPRITE);
+        assertEquals("geo to start", null, layout.geomap());
+        try {
+            layout.geomap(GEOMAP);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_SPRITES_SET, e.getMessage());
+        }
+    }
+
+    @Test
+    public void setSprites() {
+        mkRootLayout();
+        assertEquals("sprite to start", null, layout.sprites());
+        layout.sprites(SPRITE);
+        assertEquals("wrong sprite", SPRITE, layout.sprites());
+    }
+
+    @Test
+    public void setSpritesAfterGeomap() {
+        mkRootLayout();
+        layout.geomap(GEOMAP);
+        assertEquals("sprites to start", null, layout.sprites());
+        try {
+            layout.sprites(SPRITE);
+            fail(AM_NOEX);
+        } catch (IllegalArgumentException e) {
+            assertEquals(AM_WREXMSG, E_GEOMAP_SET, e.getMessage());
+        }
+    }
+
+    @Test
+    public void setScale() {
+        mkRootLayout();
+        layout.scale(3.0);
+        assertEquals("wrong scale", 3.0, layout.scale(), DELTA);
+        layout.scale(0.05);
+        assertEquals("wrong scale", 0.05, layout.scale(), DELTA);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void scaleTooSmall() {
+        mkRootLayout();
+        layout.scale(0.0099);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void scaleTooBig() {
+        mkRootLayout();
+        layout.scale(100.009);
+    }
+
+    @Test
+    public void setXOff() {
+        mkOtherLayout();
+        layout.offsetX(23.4);
+        assertEquals("wrong x-offset", 23.4, layout.offsetX(), DELTA);
+    }
+
+    @Test
+    public void setYOff() {
+        mkOtherLayout();
+        layout.offsetY(2.71828);
+        assertEquals("wrong y-offset", 2.71828, layout.offsetY(), DELTA);
+    }
+
+}
diff --git a/tools/test/topos/uk-region.json b/tools/test/topos/uk-region.json
index a498bc9..7b42fa7 100644
--- a/tools/test/topos/uk-region.json
+++ b/tools/test/topos/uk-region.json
@@ -94,5 +94,4 @@
       }
     }
   }
-
 }
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoLayoutManager.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoLayoutManager.java
index 5e6927f..193191c 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoLayoutManager.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoLayoutManager.java
@@ -23,12 +23,11 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.Service;
-import org.onlab.util.KryoNamespace;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.basics.BasicUiTopoLayoutConfig;
 import org.onosproject.net.region.RegionId;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.ConsistentMap;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
 import org.onosproject.ui.UiTopoLayoutService;
 import org.onosproject.ui.model.topo.UiRegion;
 import org.onosproject.ui.model.topo.UiTopoLayout;
@@ -37,6 +36,7 @@
 import org.slf4j.LoggerFactory;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -54,38 +54,34 @@
 @Service
 public class UiTopoLayoutManager implements UiTopoLayoutService {
 
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
     private static final String ID_NULL = "Layout ID cannot be null";
     private static final String LAYOUT_NULL = "Layout cannot be null";
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected StorageService storageService;
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private ConsistentMap<UiTopoLayoutId, UiTopoLayout> layouts;
-    private Map<UiTopoLayoutId, UiTopoLayout> layoutMap;
+    private final InternalConfigListener cfgListener = new InternalConfigListener();
+    private final Map<UiTopoLayoutId, UiTopoLayout> layoutMap = new HashMap<>();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry cfgService;
+
 
     @Activate
     public void activate() {
-        KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
-                .register(KryoNamespaces.API)
-                .register(UiTopoLayout.class);
-
-        layouts = storageService.<UiTopoLayoutId, UiTopoLayout>consistentMapBuilder()
-                .withSerializer(Serializer.using(kryoBuilder.build()))
-                .withName("onos-topo-layouts")
-                .withRelaxedReadConsistency()
-                .build();
-        layoutMap = layouts.asJavaMap();
 
         // Create and add the default layout, if needed.
-        layoutMap.computeIfAbsent(DEFAULT_ID, k -> new UiTopoLayout(k, null, null));
+        layoutMap.computeIfAbsent(DEFAULT_ID, UiTopoLayout::new);
+
+        cfgService.addListener(cfgListener);
+        cfgListener.initAllConfigs();
 
         log.info("Started");
     }
 
     @Deactivate
     public void deactivate() {
+        cfgService.removeListener(cfgListener);
+
         log.info("Stopped");
     }
 
@@ -103,7 +99,7 @@
     @Override
     public boolean addLayout(UiTopoLayout layout) {
         checkNotNull(layout, LAYOUT_NULL);
-        return layouts.put(layout.id(), layout) == null;
+        return layoutMap.put(layout.id(), layout) == null;
     }
 
     @Override
@@ -153,7 +149,51 @@
     @Override
     public boolean removeLayout(UiTopoLayout layout) {
         checkNotNull(layout, LAYOUT_NULL);
-        return layouts.remove(layout.id()) != null;
+        return layoutMap.remove(layout.id()) != null;
     }
 
+    /*
+     * Listens for changes to layout configs, updating instances as necessary
+     */
+    private class InternalConfigListener implements NetworkConfigListener {
+
+        // look up the current config by layout ID and apply it
+        private void updateLayoutConfig(UiTopoLayoutId id) {
+            BasicUiTopoLayoutConfig cfg =
+                    cfgService.getConfig(id, BasicUiTopoLayoutConfig.class);
+
+            log.info("Updating Layout via config... {}: {}", id, cfg);
+
+            UiTopoLayout layout = layoutMap.get(id);
+
+            // NOTE: if a value is null, then that null-ness should be set
+            // TODO: add setters on UiTopoLayout and implement...
+//            layout
+//              .region(cfg.region())
+//              .parent(cfg.parent())
+//              .geomap(cfg.geomap())
+//              .sprites(cfg.sprites())
+//              .scale(cfg.scale())
+//              .offsetX(cfg.offsetX())
+//              .offsetY(cfg.offsetY());
+        }
+
+        private void initAllConfigs() {
+            log.info("Initializing layout configurations...");
+            layoutMap.keySet().forEach(this::updateLayoutConfig);
+        }
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            UiTopoLayoutId id = (UiTopoLayoutId) event.subject();
+            updateLayoutConfig(id);
+        }
+
+        @Override
+        public boolean isRelevant(NetworkConfigEvent event) {
+            return (event.type() == NetworkConfigEvent.Type.CONFIG_ADDED ||
+                    event.type() == NetworkConfigEvent.Type.CONFIG_UPDATED) &&
+                    event.configClass().equals(BasicUiTopoLayoutConfig.class);
+        }
+    }
 }
diff --git a/web/gui/src/test/java/org/onosproject/ui/impl/topo/UiTopoLayoutManagerTest.java b/web/gui/src/test/java/org/onosproject/ui/impl/topo/UiTopoLayoutManagerTest.java
index 10ceb8a..67fbf69 100644
--- a/web/gui/src/test/java/org/onosproject/ui/impl/topo/UiTopoLayoutManagerTest.java
+++ b/web/gui/src/test/java/org/onosproject/ui/impl/topo/UiTopoLayoutManagerTest.java
@@ -19,45 +19,62 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onosproject.net.config.NetworkConfigRegistryAdapter;
 import org.onosproject.net.region.DefaultRegion;
 import org.onosproject.net.region.Region;
-import org.onosproject.net.region.RegionId;
-import org.onosproject.store.service.TestStorageService;
 import org.onosproject.ui.UiTopoLayoutService;
 import org.onosproject.ui.model.topo.UiTopoLayout;
 import org.onosproject.ui.model.topo.UiTopoLayoutId;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onosproject.net.region.Region.Type.CAMPUS;
+import static org.onosproject.net.region.RegionId.regionId;
+import static org.onosproject.ui.model.topo.UiTopoLayoutId.layoutId;
 
 /**
  * Suite of unit tests for the UI topology layout manager.
  */
 public class UiTopoLayoutManagerTest {
 
+    private static class MockConfigService extends NetworkConfigRegistryAdapter {
+    }
+
+    private static Region region(String id, String name, Region.Type type) {
+        return new DefaultRegion(regionId(id), name, type, null);
+    }
+
+    private static UiTopoLayout layout(String id, Region region, String parentId) {
+        UiTopoLayoutId parent = parentId == null ? null : layoutId(parentId);
+        UiTopoLayout layout = new UiTopoLayout(layoutId(id));
+        // TODO: set region and parent
+        return layout;
+    }
+
+    private static final Region R1 = region("r1", "R1", CAMPUS);
+    private static final Region R2 = region("r2", "R2", CAMPUS);
+
+    private static final UiTopoLayout L1 = layout("l1", R1, null);
+    private static final UiTopoLayout L2 = layout("l2", R2, null);
+
+
     private UiTopoLayoutService svc;
     private UiTopoLayoutManager mgr;
 
-    private static final UiTopoLayout L1 =
-            new UiTopoLayout(UiTopoLayoutId.layoutId("l1"),
-                             new DefaultRegion(RegionId.regionId("r1"), "R1",
-                                               Region.Type.CAMPUS, null), null);
-    private static final UiTopoLayout L2 =
-            new UiTopoLayout(UiTopoLayoutId.layoutId("l2"),
-                             new DefaultRegion(RegionId.regionId("r2"), "R2",
-                                               Region.Type.CAMPUS, null), null);
 
     @Before
     public void setUp() {
         mgr = new UiTopoLayoutManager();
         svc = mgr;
-        mgr.storageService = new TestStorageService();
+
+        mgr.cfgService = new MockConfigService();
         mgr.activate();
     }
 
     @After
     public void tearDown() {
         mgr.deactivate();
-        mgr.storageService = null;
+        mgr.cfgService = null;
     }
 
     @Test
diff --git a/web/gui/src/test/java/org/onosproject/ui/impl/topo/model/AbstractTopoModelTest.java b/web/gui/src/test/java/org/onosproject/ui/impl/topo/model/AbstractTopoModelTest.java
index ea48bb1..559a6be 100644
--- a/web/gui/src/test/java/org/onosproject/ui/impl/topo/model/AbstractTopoModelTest.java
+++ b/web/gui/src/test/java/org/onosproject/ui/impl/topo/model/AbstractTopoModelTest.java
@@ -263,7 +263,7 @@
                                          String parentId) {
         UiTopoLayoutId pid = parentId == null
                 ? UiTopoLayoutId.DEFAULT_ID : layoutId(parentId);
-        return new UiTopoLayout(layoutId(layoutId), region, pid);
+        return new UiTopoLayout(layoutId(layoutId)).region(region).parent(pid);
     }
 
     /**
