[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);
}
}