@Override
    public void createNode(K8sNode node) {
        checkNotNull(node, ERR_NULL_NODE);

        K8sNode intNode;
        K8sNode extNode;
        K8sNode localNode;
        K8sNode tunNode;

        if (node.intgBridge() == null) {
            String deviceIdStr = genDpid(deviceIdCounter.incrementAndGet());
            checkNotNull(deviceIdStr, ERR_NULL_DEVICE_ID);
            intNode = node.updateIntgBridge(DeviceId.deviceId(deviceIdStr));
            checkArgument(!hasIntgBridge(intNode.intgBridge(), intNode.hostname()),
                    NOT_DUPLICATED_MSG, intNode.intgBridge());
        } else {
            intNode = node;
            checkArgument(!hasIntgBridge(intNode.intgBridge(), intNode.hostname()),
                    NOT_DUPLICATED_MSG, intNode.intgBridge());
        }

        if (intNode.extBridge() == null) {
            String deviceIdStr = genDpid(deviceIdCounter.incrementAndGet());
            checkNotNull(deviceIdStr, ERR_NULL_DEVICE_ID);
            extNode = intNode.updateExtBridge(DeviceId.deviceId(deviceIdStr));
            checkArgument(!hasExtBridge(extNode.extBridge(), extNode.hostname()),
                    NOT_DUPLICATED_MSG, extNode.extBridge());
        } else {
            extNode = intNode;
            checkArgument(!hasExtBridge(extNode.extBridge(), extNode.hostname()),
                    NOT_DUPLICATED_MSG, extNode.extBridge());
        }

        if (node.localBridge() == null) {
            String deviceIdStr = genDpid(deviceIdCounter.incrementAndGet());
            checkNotNull(deviceIdStr, ERR_NULL_DEVICE_ID);
            localNode = extNode.updateLocalBridge(DeviceId.deviceId(deviceIdStr));
            checkArgument(!hasLocalBridge(localNode.localBridge(), localNode.hostname()),
                    NOT_DUPLICATED_MSG, localNode.localBridge());
        } else {
            localNode = extNode;
            checkArgument(!hasLocalBridge(localNode.localBridge(), localNode.hostname()),
                    NOT_DUPLICATED_MSG, localNode.localBridge());
        }

        if (node.mode() == NORMAL) {
            if (node.tunBridge() == null) {
                String deviceIdStr = genDpid(deviceIdCounter.incrementAndGet());
                checkNotNull(deviceIdStr, ERR_NULL_DEVICE_ID);
                tunNode = localNode.updateTunBridge(DeviceId.deviceId(deviceIdStr));
                checkArgument(!hasTunBridge(tunNode.tunBridge(), tunNode.hostname()),
                        NOT_DUPLICATED_MSG, tunNode.tunBridge());
            } else {
                tunNode = localNode;
                checkArgument(!hasTunBridge(tunNode.tunBridge(), tunNode.hostname()),
                        NOT_DUPLICATED_MSG, tunNode.tunBridge());
            }

            nodeStore.createNode(tunNode);
        } else {
            nodeStore.createNode(localNode);
        }

        log.info(String.format(MSG_NODE, extNode.hostname(), MSG_CREATED));
    }
@Test(expected = NullPointerException.class)
    public void testCreateNullNode() {
        target.createNode(null);
    }