[ONOS-7621] Support injecting keystone auth info through network-cfg

Change-Id: I2439e257f0f576c46b68322b8c8f1c87fa2cc9ae
diff --git a/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/Constants.java b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/Constants.java
index 8bf4ceb..c10820e 100644
--- a/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/Constants.java
+++ b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/Constants.java
@@ -29,6 +29,7 @@
     public static final String PATCH_INTG_BRIDGE = "patch-intg";
     public static final String PATCH_ROUT_BRIDGE = "patch-rout";
     public static final String GATEWAY = "GATEWAY";
+    public static final String CONTROLLER = "CONTROLLER";
     public static final String HOST_NAME = "hostname";
     public static final String TYPE = "type";
     public static final String MANAGEMENT_IP = "managementIp";
diff --git a/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackAuth.java b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackAuth.java
new file mode 100644
index 0000000..e7e04cb
--- /dev/null
+++ b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackAuth.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.openstacknode.api;
+
+/**
+ * Representation of keystone authentication information.
+ */
+public interface OpenstackAuth {
+
+    /**
+     * Keystone authentication protocol types.
+     */
+    enum Protocol {
+        HTTP,
+        HTTPS
+    }
+
+    /**
+     * Keystone user perspective.
+     */
+    enum Perspective {
+        ADMIN,
+        INTERNAL,
+        PUBLIC
+    }
+
+    /**
+     * Returns the keystone authentication version number.
+     *
+     * @return keystone authentication version
+     */
+    String version();
+
+    /**
+     * Returns the keystone authentication port number.
+     *
+     * @return keystone authentication port number
+     */
+    Integer port();
+
+    /**
+     * Returns the keystone authentication protocol type.
+     *
+     * @return keystone authentication protocol type
+     */
+    Protocol protocol();
+
+    /**
+     * Returns the keystone username.
+     *
+     * @return keystone username
+     */
+    String username();
+
+    /**
+     * Returns the keystone user password.
+     *
+     * @return keystone password
+     */
+    String password();
+
+    /**
+     * Returns the project name.
+     *
+     * @return project name
+     */
+    String project();
+
+    /**
+     * Returns the user perspective.
+     *
+     * @return user perspective
+     */
+    Perspective perspective();
+
+    /**
+     * Builder of keystone authentication info.
+     */
+    interface Builder {
+
+        /**
+         * Builds an immutable openstack keystone authentication instance.
+         *
+         * @return keystone authentication instance
+         */
+        OpenstackAuth build();
+
+        /**
+         * Returns keystone authentication builder with supplied version number.
+         *
+         * @param version version number
+         * @return keystone authentication builder
+         */
+        Builder version(String version);
+
+        /**
+         * Returns keystone authentication builder with supplied port number.
+         *
+         * @param port port number
+         * @return keystone authentication builder
+         */
+        Builder port(Integer port);
+
+        /**
+         * Returns keystone authentication builder with supplied protocol.
+         *
+         * @param protocol protocol
+         * @return keystone authentication builder
+         */
+        Builder protocol(Protocol protocol);
+
+        /**
+         * Returns keystone authentication builder with supplied username.
+         *
+         * @param username username
+         * @return keystone authentication builder
+         */
+        Builder username(String username);
+
+        /**
+         * Returns keystone authentication builder with supplied password.
+         *
+         * @param password password
+         * @return keystone authentication builder
+         */
+        Builder password(String password);
+
+        /**
+         * Returns keystone authentication builder with supplied project.
+         *
+         * @param project project name
+         * @return keystone authentication builder
+         */
+        Builder project(String project);
+
+        /**
+         * Returns keystone authentication builder with supplied perspective.
+         *
+         * @param perspective perspective
+         * @return keystone authentication builder
+         */
+        Builder perspective(Perspective perspective);
+
+    }
+}
diff --git a/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackNode.java b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackNode.java
index b25887e..25b795c 100644
--- a/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackNode.java
+++ b/apps/openstacknode/api/src/main/java/org/onosproject/openstacknode/api/OpenstackNode.java
@@ -44,7 +44,8 @@
      */
     enum NodeType {
         COMPUTE,
-        GATEWAY
+        GATEWAY,
+        CONTROLLER
     }
 
     /**
@@ -185,6 +186,13 @@
     PortNumber phyIntfPortNum(String providerPhysnet);
 
     /**
+     * Returns the keystone authentication info.
+     *
+     * @return keystone authentication info
+     */
+    OpenstackAuth authentication();
+
+    /**
      * Builder of new node entities.
      */
     interface Builder {
@@ -267,6 +275,14 @@
          * @return openstack node builder
          */
         Builder phyIntfs(Collection<OpenstackPhyInterface> phyIntfs);
+
+        /**
+         * Returns openstack node builder with supplied authentication info.
+         *
+         * @param auth keystone authentication info
+         * @return openstack node builder
+         */
+        Builder authentication(OpenstackAuth auth);
     }
 }
 
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackAuthCodec.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackAuthCodec.java
new file mode 100644
index 0000000..5556d9c
--- /dev/null
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackAuthCodec.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.openstacknode.codec;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.openstacknode.api.OpenstackAuth;
+import org.onosproject.openstacknode.impl.DefaultOpenstackAuth;
+import org.slf4j.Logger;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onlab.util.Tools.nullIsIllegal;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Openstack keystone authentication codec used for serializing and
+ * de-serializing JSON string.
+ */
+public class OpenstackAuthCodec extends JsonCodec<OpenstackAuth> {
+
+    private final Logger log = getLogger(getClass());
+
+    private static final String VERSION = "version";
+    private static final String PORT = "port";
+    private static final String PROTOCOL = "protocol";
+    private static final String USERNAME = "username";
+    private static final String PASSWORD = "password";
+    private static final String PROJECT = "project";
+    private static final String PERSPECTIVE = "perspective";
+
+    private static final String MISSING_MESSAGE = " is required in OpenstackAuth";
+
+    @Override
+    public ObjectNode encode(OpenstackAuth auth, CodecContext context) {
+        checkNotNull(auth, "Openstack auth cannot be null");
+
+        ObjectNode result = context.mapper().createObjectNode()
+                .put(VERSION, auth.version())
+                .put(PORT, auth.port())
+                .put(PROTOCOL, auth.protocol().name())
+                .put(USERNAME, auth.username())
+                .put(PASSWORD, auth.password())
+                .put(PROJECT, auth.project());
+
+        if (auth.perspective() != null) {
+            result.put(PERSPECTIVE, auth.perspective().name());
+        }
+
+        return result;
+    }
+
+    @Override
+    public OpenstackAuth decode(ObjectNode json, CodecContext context) {
+        if (json == null || !json.isObject()) {
+            return null;
+        }
+
+        String version = nullIsIllegal(json.get(VERSION).asText(),
+                VERSION + MISSING_MESSAGE);
+        Integer port = nullIsIllegal(json.get(PORT).asInt(),
+                PORT + MISSING_MESSAGE);
+        String protocol = nullIsIllegal(json.get(PROTOCOL).asText(),
+                PROTOCOL + MISSING_MESSAGE);
+        String username = nullIsIllegal(json.get(USERNAME).asText(),
+                USERNAME + MISSING_MESSAGE);
+        String password = nullIsIllegal(json.get(PASSWORD).asText(),
+                PASSWORD + MISSING_MESSAGE);
+        String project = nullIsIllegal(json.get(PROJECT).asText(),
+                PROJECT + MISSING_MESSAGE);
+
+        DefaultOpenstackAuth.Builder authBuilder = DefaultOpenstackAuth.builder()
+                .version(version)
+                .port(port)
+                .protocol(OpenstackAuth.Protocol.valueOf(protocol))
+                .username(username)
+                .password(password)
+                .project(project);
+
+        if (json.get(PERSPECTIVE) != null) {
+            authBuilder.perspective(
+                    OpenstackAuth.Perspective.valueOf(json.get(PERSPECTIVE).asText()));
+        }
+
+        return authBuilder.build();
+    }
+}
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackNodeCodec.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackNodeCodec.java
index 3c5feba..1d30bf6 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackNodeCodec.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/codec/OpenstackNodeCodec.java
@@ -23,6 +23,7 @@
 import org.onosproject.codec.JsonCodec;
 import org.onosproject.net.DeviceId;
 import org.onosproject.openstacknode.api.NodeState;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
 import org.onosproject.openstacknode.impl.DefaultOpenstackNode;
@@ -34,6 +35,7 @@
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onlab.util.Tools.nullIsIllegal;
+import static org.onosproject.openstacknode.api.Constants.CONTROLLER;
 import static org.onosproject.openstacknode.api.Constants.DATA_IP;
 import static org.onosproject.openstacknode.api.Constants.GATEWAY;
 import static org.onosproject.openstacknode.api.Constants.HOST_NAME;
@@ -53,6 +55,7 @@
     private static final String INTEGRATION_BRIDGE = "integrationBridge";
     private static final String STATE = "state";
     private static final String PHYSICAL_INTERFACES = "phyIntfs";
+    private static final String AUTHENTICATION = "authentication";
 
     private static final String MISSING_MESSAGE = " is required in OpenstackNode";
 
@@ -64,7 +67,6 @@
                 .put(HOST_NAME, node.hostname())
                 .put(TYPE, node.type().name())
                 .put(MANAGEMENT_IP, node.managementIp().toString())
-                .put(INTEGRATION_BRIDGE, node.intgBridge().toString())
                 .put(STATE, node.state().name());
 
         OpenstackNode.NodeType type = node.type();
@@ -73,6 +75,10 @@
             result.put(UPLINK_PORT, node.uplinkPort());
         }
 
+        if (type != OpenstackNode.NodeType.CONTROLLER) {
+            result.put(INTEGRATION_BRIDGE, node.intgBridge().toString());
+        }
+
         if (node.vlanIntf() != null) {
             result.put(VLAN_INTF_NAME, node.vlanIntf());
         }
@@ -91,6 +97,12 @@
         });
         result.set(PHYSICAL_INTERFACES, phyIntfs);
 
+        if (node.authentication() != null) {
+            ObjectNode authJson = context.codec(OpenstackAuth.class)
+                    .encode(node.authentication(), context);
+            result.put(AUTHENTICATION, authJson);
+        }
+
         return result;
     }
 
@@ -100,28 +112,28 @@
             return null;
         }
 
-        final JsonCodec<OpenstackPhyInterface> phyIntfCodec = context.codec(OpenstackPhyInterface.class);
-
         String hostname = nullIsIllegal(json.get(HOST_NAME).asText(),
                 HOST_NAME + MISSING_MESSAGE);
         String type = nullIsIllegal(json.get(TYPE).asText(),
                 TYPE + MISSING_MESSAGE);
         String mIp = nullIsIllegal(json.get(MANAGEMENT_IP).asText(),
                 MANAGEMENT_IP + MISSING_MESSAGE);
-        String iBridge = nullIsIllegal(json.get(INTEGRATION_BRIDGE).asText(),
-                INTEGRATION_BRIDGE + MISSING_MESSAGE);
 
         DefaultOpenstackNode.Builder nodeBuilder = DefaultOpenstackNode.builder()
                 .hostname(hostname)
                 .type(OpenstackNode.NodeType.valueOf(type))
                 .managementIp(IpAddress.valueOf(mIp))
-                .intgBridge(DeviceId.deviceId(iBridge))
                 .state(NodeState.INIT);
 
         if (type.equals(GATEWAY)) {
             nodeBuilder.uplinkPort(nullIsIllegal(json.get(UPLINK_PORT).asText(),
                     UPLINK_PORT + MISSING_MESSAGE));
         }
+        if (!type.equals(CONTROLLER)) {
+            String iBridge = nullIsIllegal(json.get(INTEGRATION_BRIDGE).asText(),
+                    INTEGRATION_BRIDGE + MISSING_MESSAGE);
+            nodeBuilder.intgBridge(DeviceId.deviceId(iBridge));
+        }
         if (json.get(VLAN_INTF_NAME) != null) {
             nodeBuilder.vlanIntf(json.get(VLAN_INTF_NAME).asText());
         }
@@ -133,6 +145,10 @@
         List<OpenstackPhyInterface> phyIntfs = new ArrayList<>();
         JsonNode phyIntfsJson = json.get(PHYSICAL_INTERFACES);
         if (phyIntfsJson != null) {
+
+            final JsonCodec<OpenstackPhyInterface>
+                    phyIntfCodec = context.codec(OpenstackPhyInterface.class);
+
             IntStream.range(0, phyIntfsJson.size()).forEach(i -> {
                 ObjectNode intfJson = get(phyIntfsJson, i);
                 phyIntfs.add(phyIntfCodec.decode(intfJson, context));
@@ -140,6 +156,16 @@
         }
         nodeBuilder.phyIntfs(phyIntfs);
 
+        // parse authentication
+        JsonNode authJson = json.get(AUTHENTICATION);
+        if (json.get(AUTHENTICATION) != null) {
+
+            final JsonCodec<OpenstackAuth> authCodec = context.codec(OpenstackAuth.class);
+
+            OpenstackAuth auth = authCodec.decode((ObjectNode) authJson.deepCopy(), context);
+            nodeBuilder.authentication(auth);
+        }
+
         log.trace("node is {}", nodeBuilder.build().toString());
 
         return nodeBuilder.build();
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuth.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuth.java
new file mode 100644
index 0000000..3257353
--- /dev/null
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuth.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.openstacknode.impl;
+
+import com.google.common.base.MoreObjects;
+import org.onosproject.openstacknode.api.OpenstackAuth;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+public class DefaultOpenstackAuth implements OpenstackAuth {
+
+    private final String version;
+    private final Integer port;
+    private final Protocol protocol;
+    private final String username;
+    private final String password;
+    private final String project;
+    private final Perspective perspective;
+
+    private static final String NOT_NULL_MSG = "% cannot be null";
+
+    /**
+     * A default constructor of keystone authentication instance.
+     *
+     * @param version       version number
+     * @param port          endpoint port number
+     * @param protocol      endpoint protocol type
+     * @param username      keystone username
+     * @param password      keystone password
+     * @param project       project name
+     * @param perspective   user perspective
+     */
+    protected DefaultOpenstackAuth(String version, Integer port, Protocol protocol,
+                                   String username, String password, String project,
+                                   Perspective perspective) {
+
+        this.version = version;
+        this.port = port;
+        this.protocol = protocol;
+        this.username = username;
+        this.password = password;
+        this.project = project;
+        this.perspective = perspective;
+    }
+
+    @Override
+    public String version() {
+        return version;
+    }
+
+    @Override
+    public Integer port() {
+        return port;
+    }
+
+    @Override
+    public Protocol protocol() {
+        return protocol;
+    }
+
+    @Override
+    public String username() {
+        return username;
+    }
+
+    @Override
+    public String password() {
+        return password;
+    }
+
+    @Override
+    public String project() {
+        return project;
+    }
+
+    @Override
+    public Perspective perspective() {
+        return perspective;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof DefaultOpenstackAuth) {
+            DefaultOpenstackAuth that = (DefaultOpenstackAuth) obj;
+            return Objects.equals(version, that.version) &&
+                    Objects.equals(port, that.port) &&
+                    Objects.equals(protocol, that.protocol) &&
+                    Objects.equals(username, that.username) &&
+                    Objects.equals(password, that.password) &&
+                    Objects.equals(project, that.project) &&
+                    Objects.equals(perspective, that.perspective);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(version,
+                port,
+                protocol,
+                username,
+                password,
+                project,
+                perspective);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("version", version)
+                .add("port", port)
+                .add("protocol", protocol)
+                .add("username", username)
+                .add("password", password)
+                .add("project", project)
+                .add("perspective", perspective)
+                .toString();
+    }
+
+    /**
+     * Returns new builder instance.
+     *
+     * @return keystone authentication instance builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * A builder class for openstack authentication.
+     */
+    public static final class Builder implements OpenstackAuth.Builder {
+
+        private String version;
+        private Integer port;
+        private Protocol protocol;
+        private String username;
+        private String password;
+        private String project;
+        private Perspective perspective;
+
+        // private constructor not intended to use from external
+        private Builder() {
+        }
+
+        @Override
+        public OpenstackAuth build() {
+            checkArgument(version != null, NOT_NULL_MSG, "version");
+            checkArgument(port != null, NOT_NULL_MSG, "port");
+            checkArgument(protocol != null, NOT_NULL_MSG, "protocol");
+            checkArgument(username != null, NOT_NULL_MSG, "username");
+            checkArgument(password != null, NOT_NULL_MSG, "password");
+            checkArgument(project != null, NOT_NULL_MSG, "project");
+
+            return new DefaultOpenstackAuth(version,
+                    port,
+                    protocol,
+                    username,
+                    password,
+                    project,
+                    perspective);
+        }
+
+        @Override
+        public Builder version(String version) {
+            this.version = version;
+            return this;
+        }
+
+        @Override
+        public Builder port(Integer port) {
+            this.port = port;
+            return this;
+        }
+
+        @Override
+        public Builder protocol(Protocol protocol) {
+            this.protocol = protocol;
+            return this;
+        }
+
+        @Override
+        public Builder username(String username) {
+            this.username = username;
+            return this;
+        }
+
+        @Override
+        public Builder password(String password) {
+            this.password = password;
+            return this;
+        }
+
+        @Override
+        public Builder project(String project) {
+            this.project = project;
+            return this;
+        }
+
+        @Override
+        public Builder perspective(Perspective perspective) {
+            this.perspective = perspective;
+            return this;
+        }
+    }
+}
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNode.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNode.java
index c632847..f05d58b 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNode.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNode.java
@@ -28,6 +28,7 @@
 import org.onosproject.net.group.DefaultGroupKey;
 import org.onosproject.net.group.GroupKey;
 import org.onosproject.openstacknode.api.NodeState;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
 
@@ -56,6 +57,7 @@
     private final String uplinkPort;
     private final NodeState state;
     private final Collection<OpenstackPhyInterface> phyIntfs;
+    private final OpenstackAuth auth;
 
     private static final String NOT_NULL_MSG = "Node % cannot be null";
 
@@ -73,6 +75,7 @@
      * @param uplinkPort    uplink port name
      * @param state         node state
      * @param phyIntfs      physical interfaces
+     * @param auth          keystone authentication info
      */
     protected DefaultOpenstackNode(String hostname, NodeType type,
                                    DeviceId intgBridge,
@@ -81,7 +84,8 @@
                                    String vlanIntf,
                                    String uplinkPort,
                                    NodeState state,
-                                   Collection<OpenstackPhyInterface> phyIntfs) {
+                                   Collection<OpenstackPhyInterface> phyIntfs,
+                                   OpenstackAuth auth) {
         this.hostname = hostname;
         this.type = type;
         this.intgBridge = intgBridge;
@@ -91,6 +95,7 @@
         this.uplinkPort = uplinkPort;
         this.state = state;
         this.phyIntfs = phyIntfs;
+        this.auth = auth;
     }
 
     @Override
@@ -229,7 +234,8 @@
                     Objects.equals(dataIp, that.dataIp) &&
                     Objects.equals(uplinkPort, that.uplinkPort) &&
                     Objects.equals(vlanIntf, that.vlanIntf) &&
-                    Objects.equals(phyIntfs, that.phyIntfs);
+                    Objects.equals(phyIntfs, that.phyIntfs) &&
+                    Objects.equals(auth, that.auth);
         }
         return false;
     }
@@ -243,7 +249,8 @@
                 dataIp,
                 vlanIntf,
                 uplinkPort,
-                phyIntfs);
+                phyIntfs,
+                auth);
     }
 
     @Override
@@ -258,6 +265,7 @@
                 .add("uplinkPort", uplinkPort)
                 .add("state", state)
                 .add("phyIntfs", phyIntfs)
+                .add("auth", auth)
                 .toString();
     }
 
@@ -273,6 +281,7 @@
                 .uplinkPort(uplinkPort)
                 .state(newState)
                 .phyIntfs(phyIntfs)
+                .authentication(auth)
                 .build();
     }
 
@@ -304,6 +313,12 @@
         }
 
     }
+
+    @Override
+    public OpenstackAuth authentication() {
+        return auth;
+    }
+
     /**
      * Returns new builder instance.
      *
@@ -329,7 +344,8 @@
                 .vlanIntf(osNode.vlanIntf())
                 .uplinkPort(osNode.uplinkPort())
                 .state(osNode.state())
-                .phyIntfs(osNode.phyIntfs());
+                .phyIntfs(osNode.phyIntfs())
+                .authentication(osNode.authentication());
     }
 
     /**
@@ -346,6 +362,7 @@
         private String uplinkPort;
         private NodeState state;
         private Collection<OpenstackPhyInterface> phyIntfs;
+        private OpenstackAuth auth;
 
         // private constructor not intended to use from external
         private Builder() {
@@ -355,16 +372,24 @@
         public DefaultOpenstackNode build() {
             checkArgument(hostname != null, NOT_NULL_MSG, "hostname");
             checkArgument(type != null, NOT_NULL_MSG, "type");
-            checkArgument(intgBridge != null, NOT_NULL_MSG, "integration bridge");
+
             checkArgument(managementIp != null, NOT_NULL_MSG, "management IP");
             checkArgument(state != null, NOT_NULL_MSG, "state");
 
+            if (type != NodeType.CONTROLLER) {
+                checkArgument(intgBridge != null, NOT_NULL_MSG, "integration bridge");
+
+                if (dataIp == null && Strings.isNullOrEmpty(vlanIntf)) {
+                    throw new IllegalArgumentException("Either data IP or VLAN interface is required");
+                }
+            } else {
+                // we force controller node to have COMPLETE state for now
+                state = NodeState.COMPLETE;
+            }
+
             if (type == NodeType.GATEWAY && uplinkPort == null) {
                 throw new IllegalArgumentException("Uplink port is required for gateway node");
             }
-            if (dataIp == null && Strings.isNullOrEmpty(vlanIntf)) {
-                throw new IllegalArgumentException("Either data IP or VLAN interface is required");
-            }
 
             return new DefaultOpenstackNode(hostname,
                     type,
@@ -374,7 +399,8 @@
                     vlanIntf,
                     uplinkPort,
                     state,
-                    phyIntfs);
+                    phyIntfs,
+                    auth);
         }
 
         @Override
@@ -432,6 +458,12 @@
             this.phyIntfs = phyIntfs;
             return this;
         }
+
+        @Override
+        public Builder authentication(OpenstackAuth auth) {
+            this.auth = auth;
+            return this;
+        }
     }
 }
 
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandler.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandler.java
index 025757e..b9e193a 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandler.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandler.java
@@ -51,7 +51,6 @@
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.flow.instructions.ExtensionPropertyException;
 import org.onosproject.net.flow.instructions.ExtensionTreatment;
-
 import org.onosproject.openstacknode.api.NodeState;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackNodeAdminService;
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DistributedOpenstackNodeStore.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DistributedOpenstackNodeStore.java
index d3c2ce4..be49135 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DistributedOpenstackNodeStore.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/impl/DistributedOpenstackNodeStore.java
@@ -50,11 +50,14 @@
 import static org.onlab.util.Tools.groupedThreads;
 import static org.onosproject.openstacknode.api.NodeState.COMPLETE;
 import static org.onosproject.openstacknode.api.NodeState.INCOMPLETE;
+import static org.onosproject.openstacknode.api.OpenstackNode.NodeType.CONTROLLER;
 import static org.onosproject.openstacknode.api.OpenstackNodeEvent.Type.OPENSTACK_NODE_COMPLETE;
 import static org.onosproject.openstacknode.api.OpenstackNodeEvent.Type.OPENSTACK_NODE_CREATED;
 import static org.onosproject.openstacknode.api.OpenstackNodeEvent.Type.OPENSTACK_NODE_INCOMPLETE;
 import static org.onosproject.openstacknode.api.OpenstackNodeEvent.Type.OPENSTACK_NODE_REMOVED;
 import static org.onosproject.openstacknode.api.OpenstackNodeEvent.Type.OPENSTACK_NODE_UPDATED;
+import static org.onosproject.store.service.MapEvent.Type.INSERT;
+import static org.onosproject.store.service.MapEvent.Type.UPDATE;
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
@@ -79,6 +82,9 @@
             .register(NodeState.class)
             .register(OpenstackPhyInterface.class)
             .register(DefaultOpenstackPhyInterface.class)
+            .register(DefaultOpenstackAuth.class)
+            .register(DefaultOpenstackAuth.Perspective.class)
+            .register(DefaultOpenstackAuth.Protocol.class)
             .register(Collection.class)
             .build();
 
@@ -159,6 +165,24 @@
 
         @Override
         public void event(MapEvent<String, OpenstackNode> event) {
+
+            OpenstackNode node;
+
+            if (event.type() == INSERT || event.type() == UPDATE) {
+                node = event.newValue().value();
+            } else {
+                node = event.oldValue().value();
+            }
+
+            // we do not notify the controller node related event
+            // controller node event should be handled in different way
+            if (node.type() == CONTROLLER) {
+                // TODO: need to find a way to check the controller node availability
+                log.info("node {} is detected", node.hostname());
+
+                return;
+            }
+
             switch (event.type()) {
                 case INSERT:
                     log.debug("OpenStack node created {}", event.newValue());
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeCodecRegister.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeCodecRegister.java
index 420e87a..c1609a9 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeCodecRegister.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeCodecRegister.java
@@ -21,8 +21,10 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onosproject.codec.CodecService;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
+import org.onosproject.openstacknode.codec.OpenstackAuthCodec;
 import org.onosproject.openstacknode.codec.OpenstackNodeCodec;
 import org.onosproject.openstacknode.codec.OpenstackPhyInterfaceCodec;
 
@@ -42,6 +44,7 @@
     @Activate
     protected void activate() {
         codecService.registerCodec(OpenstackNode.class, new OpenstackNodeCodec());
+        codecService.registerCodec(OpenstackAuth.class, new OpenstackAuthCodec());
         codecService.registerCodec(OpenstackPhyInterface.class, new OpenstackPhyInterfaceCodec());
 
         log.info("Started");
@@ -50,6 +53,7 @@
     @Deactivate
     protected void deactivate() {
         codecService.unregisterCodec(OpenstackNode.class);
+        codecService.unregisterCodec(OpenstackAuth.class);
         codecService.unregisterCodec(OpenstackPhyInterface.class);
 
         log.info("Stopped");
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackAuthJsonMatcher.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackAuthJsonMatcher.java
new file mode 100644
index 0000000..055fbe6
--- /dev/null
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackAuthJsonMatcher.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.openstacknode.codec;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeDiagnosingMatcher;
+import org.onosproject.openstacknode.api.OpenstackAuth;
+
+/**
+ * Hamcrest matcher for opensatck auth.
+ */
+public final class OpenstackAuthJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> {
+
+    private final OpenstackAuth auth;
+
+    private static final String VERSION = "version";
+    private static final String PORT = "port";
+    private static final String PROTOCOL = "protocol";
+    private static final String USERNAME = "username";
+    private static final String PASSWORD = "password";
+    private static final String PROJECT = "project";
+    private static final String PERSPECTIVE = "perspective";
+
+    private OpenstackAuthJsonMatcher(OpenstackAuth auth) {
+        this.auth = auth;
+    }
+
+    @Override
+    protected boolean matchesSafely(JsonNode jsonNode, Description description) {
+
+        // check version
+        String jsonVersion = jsonNode.get(VERSION).asText();
+        String version = auth.version();
+        if (!jsonVersion.equals(version)) {
+            description.appendText("version was " + jsonVersion);
+            return false;
+        }
+
+        // check port
+        Integer jsonPort = jsonNode.get(PORT).asInt();
+        Integer port = auth.port();
+        if (!jsonPort.equals(port)) {
+            description.appendText("port was " + jsonPort);
+            return false;
+        }
+
+        // check protocol
+        String jsonProtocol = jsonNode.get(PROTOCOL).asText();
+        String protocol = auth.protocol().name();
+        if (!jsonProtocol.equals(protocol)) {
+            description.appendText("protocol was " + jsonProtocol);
+            return false;
+        }
+
+        // check username
+        String jsonUsername = jsonNode.get(USERNAME).asText();
+        String username = auth.username();
+        if (!jsonUsername.equals(username)) {
+            description.appendText("username was " + jsonUsername);
+            return false;
+        }
+
+        // check password
+        String jsonPassword = jsonNode.get(PASSWORD).asText();
+        String password = auth.password();
+        if (!jsonPassword.equals(password)) {
+            description.appendText("password was " + jsonPassword);
+            return false;
+        }
+
+        // check project
+        String jsonProject = jsonNode.get(PROJECT).asText();
+        String project = auth.project();
+        if (!jsonProject.equals(project)) {
+            description.appendText("project was " + jsonProject);
+            return false;
+        }
+
+        // check perspective
+        String jsonPerspective = jsonNode.get(PERSPECTIVE).asText();
+        String perspective = auth.perspective().name();
+        if (!jsonPerspective.equals(perspective)) {
+            description.appendText("perspective was " + jsonPerspective);
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public void describeTo(Description description) {
+        description.appendText(auth.toString());
+    }
+
+    /**
+     * Factory to allocate an openstack auth matcher.
+     *
+     * @param auth openstack auth object we are looking for
+     * @return matcher
+     */
+    public static OpenstackAuthJsonMatcher matchOpenstackAuth(OpenstackAuth auth) {
+        return new OpenstackAuthJsonMatcher(auth);
+    }
+}
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeCodecTest.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeCodecTest.java
index cea17c4..5019234 100644
--- a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeCodecTest.java
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeCodecTest.java
@@ -29,8 +29,10 @@
 import org.onosproject.core.CoreService;
 import org.onosproject.net.DeviceId;
 import org.onosproject.openstacknode.api.NodeState;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
+import org.onosproject.openstacknode.impl.DefaultOpenstackAuth;
 import org.onosproject.openstacknode.impl.DefaultOpenstackNode;
 import org.onosproject.openstacknode.impl.DefaultOpenstackPhyInterface;
 
@@ -55,6 +57,7 @@
     MockCodecContext context;
     JsonCodec<OpenstackNode> openstackNodeCodec;
     JsonCodec<OpenstackPhyInterface> openstackPhyIntfJsonCodec;
+    JsonCodec<OpenstackAuth> openstackAuthJsonCodec;
     final CoreService mockCoreService = createMock(CoreService.class);
     private static final String REST_APP_ID = "org.onosproject.rest";
 
@@ -63,9 +66,11 @@
         context = new MockCodecContext();
         openstackNodeCodec = new OpenstackNodeCodec();
         openstackPhyIntfJsonCodec = new OpenstackPhyInterfaceCodec();
+        openstackAuthJsonCodec = new OpenstackAuthCodec();
 
         assertThat(openstackNodeCodec, notNullValue());
         assertThat(openstackPhyIntfJsonCodec, notNullValue());
+        assertThat(openstackAuthJsonCodec, notNullValue());
 
         expect(mockCoreService.registerApplication(REST_APP_ID))
                 .andReturn(APP_ID).anyTimes();
@@ -73,8 +78,11 @@
         context.registerService(CoreService.class, mockCoreService);
     }
 
+    /**
+     * Tests the openstack compute node encoding.
+     */
     @Test
-    public void testOpenstackNodeEncode() {
+    public void testOpenstackComputeNodeEncode() {
 
         OpenstackPhyInterface phyIntf1 = DefaultOpenstackPhyInterface.builder()
                                 .network("mgmtnetwork")
@@ -100,9 +108,14 @@
         assertThat(nodeJson, matchesOpenstackNode(node));
     }
 
+    /**
+     * Tests the openstack compute node decoding.
+     *
+     * @throws IOException
+     */
     @Test
-    public void testOpenstackNodeDecode() throws IOException {
-        OpenstackNode node = getOpenstackNode("OpenstackNode.json");
+    public void testOpenstackComputeNodeDecode() throws IOException {
+        OpenstackNode node = getOpenstackNode("OpenstackComputeNode.json");
 
         assertThat(node.hostname(), is("compute-01"));
         assertThat(node.type().name(), is("COMPUTE"));
@@ -123,6 +136,55 @@
     }
 
     /**
+     * Tests the openstack controller node encoding.
+     */
+    @Test
+    public void testOpenstackControllerNodeEncode() {
+        OpenstackAuth auth = DefaultOpenstackAuth.builder()
+                .version("v2.0")
+                .port(35357)
+                .protocol(OpenstackAuth.Protocol.HTTP)
+                .project("admin")
+                .username("admin")
+                .password("nova")
+                .perspective(OpenstackAuth.Perspective.PUBLIC)
+                .build();
+
+        OpenstackNode node = DefaultOpenstackNode.builder()
+                .hostname("controller")
+                .type(OpenstackNode.NodeType.CONTROLLER)
+                .state(NodeState.INIT)
+                .managementIp(IpAddress.valueOf("172.16.130.10"))
+                .authentication(auth)
+                .build();
+
+        ObjectNode nodeJson = openstackNodeCodec.encode(node, context);
+        assertThat(nodeJson, matchesOpenstackNode(node));
+    }
+
+    /**
+     * Tests the openstack controller node decoding.
+     */
+    @Test
+    public void testOpenstackControllerNodeDecode() throws IOException {
+        OpenstackNode node = getOpenstackNode("OpenstackControllerNode.json");
+
+        assertThat(node.hostname(), is("controller"));
+        assertThat(node.type().name(), is("CONTROLLER"));
+        assertThat(node.managementIp().toString(), is("172.16.130.10"));
+
+        OpenstackAuth auth = node.authentication();
+
+        assertThat(auth.version(), is("v2.0"));
+        assertThat(auth.port(), is(35357));
+        assertThat(auth.protocol(), is(OpenstackAuth.Protocol.HTTP));
+        assertThat(auth.username(), is("admin"));
+        assertThat(auth.password(), is("nova"));
+        assertThat(auth.project(), is("admin"));
+        assertThat(auth.perspective(), is(OpenstackAuth.Perspective.PUBLIC));
+    }
+
+    /**
      * Reads in an openstack node from the given resource and decodes it.
      *
      * @param resourceName resource to use to read the JSON for the rule
@@ -164,6 +226,9 @@
             if (entityClass == OpenstackPhyInterface.class) {
                 return (JsonCodec<T>) openstackPhyIntfJsonCodec;
             }
+            if (entityClass == OpenstackAuth.class) {
+                return (JsonCodec<T>) openstackAuthJsonCodec;
+            }
             return manager.getCodec(entityClass);
         }
 
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeJsonMatcher.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeJsonMatcher.java
index b9c4464..ac1d471 100644
--- a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeJsonMatcher.java
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/codec/OpenstackNodeJsonMatcher.java
@@ -19,6 +19,7 @@
 import org.hamcrest.Description;
 import org.hamcrest.TypeSafeDiagnosingMatcher;
 import org.onosproject.openstacknode.api.Constants;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
 
@@ -27,7 +28,7 @@
 import static org.onosproject.openstacknode.api.Constants.VLAN_INTF_NAME;
 
 /**
- * Hamcrest matcher for meters.
+ * Hamcrest matcher for openstack node.
  */
 public final class OpenstackNodeJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> {
 
@@ -35,6 +36,7 @@
     private static final String INTEGRATION_BRIDGE = "integrationBridge";
     private static final String STATE = "state";
     private static final String PHYSICAL_INTERFACES = "phyIntfs";
+    private static final String AUTHENTICATION = "authentication";
 
     private OpenstackNodeJsonMatcher(OpenstackNode node) {
         this.node = node;
@@ -67,11 +69,13 @@
         }
 
         // check integration bridge
-        String jsonIntgBridge = jsonNode.get(INTEGRATION_BRIDGE).asText();
-        String intgBridge = node.intgBridge().toString();
-        if (!jsonIntgBridge.equals(intgBridge)) {
-            description.appendText("integration bridge was " + jsonIntgBridge);
-            return false;
+        JsonNode jsonIntgBridge = jsonNode.get(INTEGRATION_BRIDGE);
+        if (jsonIntgBridge != null) {
+            String intgBridge = node.intgBridge().toString();
+            if (!jsonIntgBridge.asText().equals(intgBridge)) {
+                description.appendText("integration bridge was " + jsonIntgBridge);
+                return false;
+            }
         }
 
         // check state
@@ -102,6 +106,17 @@
             }
         }
 
+        // check openstack auth
+        JsonNode jsonAuth = jsonNode.get(AUTHENTICATION);
+        if (jsonAuth != null) {
+            OpenstackAuth auth = node.authentication();
+            OpenstackAuthJsonMatcher authMatcher =
+                    OpenstackAuthJsonMatcher.matchOpenstackAuth(auth);
+            if (!authMatcher.matches(jsonAuth)) {
+                return false;
+            }
+        }
+
         // check physical interfaces
         JsonNode jsonPhyIntfs = jsonNode.get(PHYSICAL_INTERFACES);
         if (jsonPhyIntfs != null) {
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuthTest.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuthTest.java
new file mode 100644
index 0000000..6442aa0
--- /dev/null
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackAuthTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.openstacknode.impl;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import org.onosproject.openstacknode.api.OpenstackAuth;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+/**
+ * Unit tests for DefaultOpenstackAuth.
+ */
+public class DefaultOpenstackAuthTest {
+
+    private static final String USERNAME = "admin";
+    private static final String PASSWORD = "nova";
+    private static final String PROJECT = "admin";
+    private static final String VERSION_1 = "v2.0";
+    private static final String VERSION_2 = "v3";
+    private static final Integer PORT_1 = 35357;
+    private static final Integer PORT_2 = 5000;
+    private static final OpenstackAuth.Protocol PROTOCOL_1 = OpenstackAuth.Protocol.HTTP;
+    private static final OpenstackAuth.Protocol PROTOCOL_2 = OpenstackAuth.Protocol.HTTPS;
+
+    private static final OpenstackAuth OS_AUTH_1 =
+                         createOpenstackAuth(VERSION_1, PORT_1, PROTOCOL_1);
+    private static final OpenstackAuth OS_AUTH_2 =
+                         createOpenstackAuth(VERSION_2, PORT_2, PROTOCOL_2);
+    private static final OpenstackAuth OS_AUTH_3 =
+                         createOpenstackAuth(VERSION_1, PORT_1, PROTOCOL_1);
+
+    private static OpenstackAuth createOpenstackAuth(String version,
+                                              Integer port,
+                                              OpenstackAuth.Protocol protocol) {
+        return DefaultOpenstackAuth.builder()
+                .version(version)
+                .port(port)
+                .protocol(protocol)
+                .username(USERNAME)
+                .password(PASSWORD)
+                .project(PROJECT)
+                .perspective(OpenstackAuth.Perspective.PUBLIC)
+                .build();
+    }
+
+    @Test
+    public void testEquality() {
+        new EqualsTester().addEqualityGroup(OS_AUTH_1, OS_AUTH_3)
+                .addEqualityGroup(OS_AUTH_2)
+                .testEquals();
+    }
+
+    @Test
+    public void testConstruction() {
+        OpenstackAuth auth = OS_AUTH_1;
+
+        assertThat(auth.version(), is("v2.0"));
+        assertThat(auth.port(), is(35357));
+        assertThat(auth.protocol(), is(OpenstackAuth.Protocol.HTTP));
+        assertThat(auth.username(), is("admin"));
+        assertThat(auth.password(), is("nova"));
+        assertThat(auth.project(), is("admin"));
+        assertThat(auth.perspective(), is(OpenstackAuth.Perspective.PUBLIC));
+    }
+}
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandlerTest.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandlerTest.java
index fccfd1b..ff59237 100644
--- a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandlerTest.java
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeHandlerTest.java
@@ -69,6 +69,7 @@
 import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.openstacknode.api.NodeState;
+import org.onosproject.openstacknode.api.OpenstackAuth;
 import org.onosproject.openstacknode.api.OpenstackNode;
 import org.onosproject.openstacknode.api.OpenstackPhyInterface;
 import org.onosproject.ovsdb.controller.OvsdbClientService;
@@ -407,7 +408,7 @@
                 intgBridge.id(),
                 ipAddr,
                 ipAddr,
-                null, null, state, phyIntfs);
+                null, null, state, phyIntfs, null);
     }
 
     private static OpenstackNode createGatewayNode(String hostname,
@@ -422,7 +423,7 @@
                 intgBridge.id(),
                 ipAddr,
                 ipAddr,
-                null, uplinkPort, state, null);
+                null, uplinkPort, state, null, null);
     }
 
     private static final class TestDevice extends DefaultDevice {
@@ -480,7 +481,8 @@
                                   String vlanIntf,
                                   String uplinkPort,
                                   NodeState state,
-                                  Set<OpenstackPhyInterface> phyIntfs) {
+                                  Set<OpenstackPhyInterface> phyIntfs,
+                                  OpenstackAuth auth) {
             super(hostname,
                     type,
                     intgBridge,
@@ -489,7 +491,8 @@
                     vlanIntf,
                     uplinkPort,
                     state,
-                    phyIntfs);
+                    phyIntfs,
+                    auth);
         }
 
         @Override
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeTest.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeTest.java
index 47ce53d..505b907 100644
--- a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeTest.java
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/impl/DefaultOpenstackNodeTest.java
@@ -91,21 +91,6 @@
     }
 
     /**
-     * Checks building a node without integration bridge ID fails with
-     * proper exception.
-     */
-    @Test(expected = IllegalArgumentException.class)
-    public void testBuildWithoutIntegrationBridgeId() {
-        DefaultOpenstackNode.builder()
-                .hostname(HOSTNAME_1)
-                .type(OpenstackNode.NodeType.COMPUTE)
-                .managementIp(TEST_IP)
-                .dataIp(TEST_IP)
-                .state(NodeState.INIT)
-                .build();
-    }
-
-    /**
      * Checks building a node without management IP address fails with
      * proper exception.
      */
diff --git a/apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackNode.json b/apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackComputeNode.json
similarity index 100%
rename from apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackNode.json
rename to apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackComputeNode.json
diff --git a/apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackControllerNode.json b/apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackControllerNode.json
new file mode 100644
index 0000000..8745d27
--- /dev/null
+++ b/apps/openstacknode/app/src/test/resources/org/onosproject/openstacknode/codec/OpenstackControllerNode.json
@@ -0,0 +1,14 @@
+{
+  "hostname": "controller",
+  "type": "CONTROLLER",
+  "managementIp": "172.16.130.10",
+  "authentication": {
+    "version": "v2.0",
+    "port": 35357,
+    "protocol": "HTTP",
+    "project": "admin",
+    "username": "admin",
+    "password": "nova",
+    "perspective": "PUBLIC"
+  }
+}
\ No newline at end of file
diff --git a/apps/openstacknode/network-cfg.json b/apps/openstacknode/network-cfg.json
index f22216e..bda74c6 100644
--- a/apps/openstacknode/network-cfg.json
+++ b/apps/openstacknode/network-cfg.json
@@ -40,6 +40,20 @@
                                 ]
                         },
                         {
+                                "hostname" : "controller",
+                                "type" : "CONTROLLER",
+                                "managementIp" : "172.16.130.10",
+                                "authentication" : {
+                                        "version" : "v2.0",
+                                        "port" : 35357,
+                                        "protocol" : "HTTP",
+                                        "project" : "admin",
+                                        "username" : "admin",
+                                        "password" : "nova",
+                                        "perspective" : "PUBLIC"
+                                }
+                        },
+                        {
                                 "hostname" : "gateway-01",
                                 "type" : "GATEWAY",
                                 "managementIp" : "172.16.130.8",