Clean up handling of lat/long geo-coordinates.

Change-Id: I64fca56c7deb9a8baa6c68558365ec2a8c38168c
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java b/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
index 9645c5f..255ee46 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/BasicHostOperator.java
@@ -34,8 +34,6 @@
  */
 public final class BasicHostOperator implements ConfigOperator {
 
-    protected static final double DEFAULT_COORD = -1.0;
-
     private BasicHostOperator() {
     }
 
@@ -81,10 +79,8 @@
         if (cfg.name() != null) {
             newBuilder.set(AnnotationKeys.NAME, cfg.name());
         }
-        if (cfg.latitude() != DEFAULT_COORD) {
+        if (cfg.geoCoordsSet()) {
             newBuilder.set(AnnotationKeys.LATITUDE, Double.toString(cfg.latitude()));
-        }
-        if (cfg.longitude() != DEFAULT_COORD) {
             newBuilder.set(AnnotationKeys.LONGITUDE, Double.toString(cfg.longitude()));
         }
         if (cfg.rackAddress() != null) {
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
index caf36d1..3d1331a 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/BasicHostOperatorTest.java
@@ -54,18 +54,20 @@
     private static final BasicHostConfig BHC = new BasicHostConfig();
     private static final String NAME = "testhost";
     private static final double LAT = 40.96;
+    private static final double LON = 0.0;
 
     @Before
     public void setUp() {
         BHC.init(ID, "test", JsonNodeFactory.instance.objectNode(), mapper, delegate);
         BHC.name(NAME).latitude(40.96);
+        // if you set lat or long, the other becomes valid as 0.0 (not null)
     }
 
     @Test
     public void testDescOps() {
         HostDescription desc = BasicHostOperator.combine(BHC, HOST);
         assertEquals(NAME, desc.annotations().value(AnnotationKeys.NAME));
-        assertEquals(null, desc.annotations().value(AnnotationKeys.LONGITUDE));
+        assertEquals(String.valueOf(LON), desc.annotations().value(AnnotationKeys.LONGITUDE));
         assertEquals(String.valueOf(LAT), desc.annotations().value(AnnotationKeys.LATITUDE));
     }
 }