ONOS-5411: Introduce basic region config.

Change-Id: I3f58e5758d0b350a9e8a03093a1475dbbacfc446
diff --git a/core/api/src/test/java/org/onosproject/net/config/basics/AbstractConfigTest.java b/core/api/src/test/java/org/onosproject/net/config/basics/AbstractConfigTest.java
new file mode 100644
index 0000000..4eb00c2
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/config/basics/AbstractConfigTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.net.config.basics;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.ConfigApplyDelegate;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.fail;
+
+/**
+ * Abstract superclass for config tests.
+ */
+abstract class AbstractConfigTest {
+
+    private static final String D_PREFIX = "of:00000000000000";
+
+    /**
+     * Shared object mapper.
+     */
+    final ObjectMapper mapper = new ObjectMapper();
+
+    /**
+     * Shared null-delegate.
+     */
+    final ConfigApplyDelegate delegate = config -> {
+    };
+
+    /**
+     * Prints the given format string with parameter replacement to stdout.
+     *
+     * @param fmt    format string
+     * @param params parameters
+     * @see String#format(String, Object...)
+     */
+    static void print(String fmt, Object... params) {
+        System.out.println(String.format(fmt, params));
+    }
+
+    /**
+     * Prints the given object's string representation to stdout.
+     *
+     * @param o the object to print
+     */
+    static void print(Object o) {
+        print("%s", o);
+    }
+
+    /**
+     * Reads in and parses the specified JSON file, returning a JSON node
+     * representation of the data. Note that if an error occurs while
+     * attempting to read the file, {@link org.junit.Assert#fail()} will be
+     * called.
+     *
+     * @param path JSON file path
+     * @return data represented as a JSON node
+     */
+    JsonNode getTestJson(String path) {
+        try {
+            InputStream is = AbstractConfigTest.class.getResourceAsStream(path);
+            return mapper.readTree(is);
+
+        } catch (IOException e) {
+            fail("Could not read json from: " + path + ": " + e.getMessage());
+        }
+        return null;
+    }
+
+    /**
+     * Returns a device identifier from a given string suffix.
+     *
+     * @param suffix two character suffix
+     * @return device identifier
+     */
+    static DeviceId dstr(String suffix) {
+        return DeviceId.deviceId(D_PREFIX + suffix);
+    }
+}