mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-05 12:16:13 +02:00
Fix: do not append identity path into V3 keystone authentication
Change-Id: Ibe68d2393658daa9a8778cfae6aa20aded3889b9
This commit is contained in:
parent
7981a32f37
commit
6d4103642e
@ -480,17 +480,7 @@ public final class OpenstackNetworkingUtil {
|
||||
StringBuilder endpointSb = new StringBuilder();
|
||||
endpointSb.append(auth.protocol().name().toLowerCase());
|
||||
endpointSb.append("://");
|
||||
endpointSb.append(node.endPoint());
|
||||
endpointSb.append(":");
|
||||
endpointSb.append(auth.port());
|
||||
endpointSb.append("/");
|
||||
|
||||
// in case the version is v3, we need to append identity path into endpoint
|
||||
if (auth.version().equals(KEYSTONE_V3)) {
|
||||
endpointSb.append(IDENTITY_PATH);
|
||||
}
|
||||
|
||||
endpointSb.append(auth.version());
|
||||
endpointSb.append(node.endpoint());
|
||||
return endpointSb.toString();
|
||||
}
|
||||
|
||||
|
||||
@ -397,12 +397,11 @@ public final class OpenstackNetworkingUtilTest {
|
||||
/**
|
||||
* Tests the getConnectedClient method.
|
||||
*/
|
||||
@Test(expected = Exception.class)
|
||||
@Test
|
||||
public void testGetConnectedClient() {
|
||||
OpenstackNode.Builder osNodeBuilderV2 = DefaultOpenstackNode.builder();
|
||||
OpenstackAuth.Builder osNodeAuthBuilderV2 = DefaultOpenstackAuth.builder()
|
||||
.version("v2.0")
|
||||
.port(35357)
|
||||
.protocol(OpenstackAuth.Protocol.HTTP)
|
||||
.project("admin")
|
||||
.username("admin")
|
||||
@ -412,16 +411,14 @@ public final class OpenstackNetworkingUtilTest {
|
||||
openstackControlNodeV2 = osNodeBuilderV2.hostname("controllerv2")
|
||||
.type(OpenstackNode.NodeType.CONTROLLER)
|
||||
.managementIp(IpAddress.valueOf("1.1.1.1"))
|
||||
.endPoint("1.1.1.1")
|
||||
.endpoint("1.1.1.1")
|
||||
.authentication(osNodeAuthBuilderV2.build())
|
||||
.state(NodeState.COMPLETE)
|
||||
.build();
|
||||
|
||||
|
||||
OpenstackNode.Builder osNodeBuilderV3 = DefaultOpenstackNode.builder();
|
||||
OpenstackAuth.Builder osNodeAuthBuilderV3 = DefaultOpenstackAuth.builder()
|
||||
.version("v2")
|
||||
.port(80)
|
||||
.protocol(OpenstackAuth.Protocol.HTTP)
|
||||
.project("admin")
|
||||
.username("admin")
|
||||
@ -431,7 +428,7 @@ public final class OpenstackNetworkingUtilTest {
|
||||
openstackControlNodeV3 = osNodeBuilderV3.hostname("controllerv3")
|
||||
.type(OpenstackNode.NodeType.CONTROLLER)
|
||||
.managementIp(IpAddress.valueOf("2.2.2.2"))
|
||||
.endPoint("2.2.2.2")
|
||||
.endpoint("2.2.2.2")
|
||||
.authentication(osNodeAuthBuilderV3.build())
|
||||
.state(NodeState.COMPLETE)
|
||||
.build();
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
"hostname" : "controller",
|
||||
"type" : "CONTROLLER",
|
||||
"managementIp" : "172.16.130.10",
|
||||
"endPoint" : "keystone-endpoint-url",
|
||||
"endpoint" : "keystone-endpoint-url",
|
||||
"authentication" : {
|
||||
"version" : "v2.0",
|
||||
"port" : 35357,
|
||||
|
||||
@ -27,7 +27,6 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
|
||||
private final String version;
|
||||
private final Integer port;
|
||||
private final Protocol protocol;
|
||||
private final String username;
|
||||
private final String password;
|
||||
@ -40,19 +39,17 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
* 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
|
||||
*/
|
||||
private DefaultOpenstackAuth(String version, Integer port, Protocol protocol,
|
||||
private DefaultOpenstackAuth(String version, 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;
|
||||
@ -65,11 +62,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Protocol protocol() {
|
||||
return protocol;
|
||||
@ -104,7 +96,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
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) &&
|
||||
@ -117,7 +108,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(version,
|
||||
port,
|
||||
protocol,
|
||||
username,
|
||||
password,
|
||||
@ -129,7 +119,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(getClass())
|
||||
.add("version", version)
|
||||
.add("port", port)
|
||||
.add("protocol", protocol)
|
||||
.add("username", username)
|
||||
.add("password", password)
|
||||
@ -153,7 +142,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
public static final class Builder implements OpenstackAuth.Builder {
|
||||
|
||||
private String version;
|
||||
private Integer port;
|
||||
private Protocol protocol;
|
||||
private String username;
|
||||
private String password;
|
||||
@ -167,14 +155,12 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
@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,
|
||||
@ -188,12 +174,6 @@ public final class DefaultOpenstackAuth implements OpenstackAuth {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder port(Integer port) {
|
||||
this.port = port;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder protocol(Protocol protocol) {
|
||||
this.protocol = protocol;
|
||||
|
||||
@ -56,7 +56,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
private final Collection<OpenstackPhyInterface> phyIntfs;
|
||||
private final Collection<ControllerInfo> controllers;
|
||||
private final OpenstackAuth auth;
|
||||
private final String endPoint;
|
||||
private final String endpoint;
|
||||
private final OpenstackSshAuth sshAuth;
|
||||
private final DatapathType datapathType;
|
||||
|
||||
@ -78,7 +78,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
* @param phyIntfs physical interfaces
|
||||
* @param controllers customized controllers
|
||||
* @param auth keystone authentication info
|
||||
* @param endPoint openstack endpoint URL
|
||||
* @param endpoint openstack endpoint URL
|
||||
* @param sshAuth ssh authentication info
|
||||
* @param datapathType data path type
|
||||
*/
|
||||
@ -92,7 +92,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
Collection<OpenstackPhyInterface> phyIntfs,
|
||||
Collection<ControllerInfo> controllers,
|
||||
OpenstackAuth auth,
|
||||
String endPoint,
|
||||
String endpoint,
|
||||
OpenstackSshAuth sshAuth,
|
||||
DatapathType datapathType) {
|
||||
this.hostname = hostname;
|
||||
@ -106,7 +106,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
this.phyIntfs = phyIntfs;
|
||||
this.controllers = controllers;
|
||||
this.auth = auth;
|
||||
this.endPoint = endPoint;
|
||||
this.endpoint = endpoint;
|
||||
this.sshAuth = sshAuth;
|
||||
this.datapathType = datapathType;
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
Objects.equals(phyIntfs, that.phyIntfs) &&
|
||||
Objects.equals(controllers, that.controllers) &&
|
||||
Objects.equals(auth, that.auth) &&
|
||||
Objects.equals(endPoint, that.endPoint) &&
|
||||
Objects.equals(endpoint, that.endpoint) &&
|
||||
Objects.equals(sshAuth, that.sshAuth) &&
|
||||
Objects.equals(datapathType, that.datapathType);
|
||||
}
|
||||
@ -274,7 +274,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
phyIntfs,
|
||||
controllers,
|
||||
auth,
|
||||
endPoint,
|
||||
endpoint,
|
||||
sshAuth,
|
||||
datapathType);
|
||||
}
|
||||
@ -293,7 +293,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
.add("phyIntfs", phyIntfs)
|
||||
.add("controllers", controllers)
|
||||
.add("auth", auth)
|
||||
.add("endpoint", endPoint)
|
||||
.add("endpoint", endpoint)
|
||||
.add("sshAuth", sshAuth)
|
||||
.add("datapathType", datapathType)
|
||||
.toString();
|
||||
@ -313,7 +313,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
.phyIntfs(phyIntfs)
|
||||
.controllers(controllers)
|
||||
.authentication(auth)
|
||||
.endPoint(endPoint)
|
||||
.endpoint(endpoint)
|
||||
.sshAuthInfo(sshAuth)
|
||||
.datapathType(datapathType)
|
||||
.build();
|
||||
@ -333,7 +333,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
.phyIntfs(phyIntfs)
|
||||
.controllers(controllers)
|
||||
.authentication(auth)
|
||||
.endPoint(endPoint)
|
||||
.endpoint(endpoint)
|
||||
.sshAuthInfo(sshAuth)
|
||||
.datapathType(datapathType)
|
||||
.build();
|
||||
@ -389,8 +389,8 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String endPoint() {
|
||||
return endPoint;
|
||||
public String endpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,7 +421,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
.phyIntfs(osNode.phyIntfs())
|
||||
.controllers(osNode.controllers())
|
||||
.authentication(osNode.authentication())
|
||||
.endPoint(osNode.endPoint())
|
||||
.endpoint(osNode.endpoint())
|
||||
.sshAuthInfo(osNode.sshAuthInfo())
|
||||
.datapathType(osNode.datapathType());
|
||||
}
|
||||
@ -442,7 +442,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
private Collection<OpenstackPhyInterface> phyIntfs;
|
||||
private Collection<ControllerInfo> controllers;
|
||||
private OpenstackAuth auth;
|
||||
private String endPoint;
|
||||
private String endpoint;
|
||||
private OpenstackSshAuth sshAuth;
|
||||
private DatapathType datapathType = DatapathType.NORMAL;
|
||||
|
||||
@ -462,7 +462,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
throw new IllegalArgumentException("Either data IP or VLAN interface is required");
|
||||
}
|
||||
} else {
|
||||
checkArgument(endPoint != null, NOT_NULL_MSG, "endpoint URL");
|
||||
checkArgument(endpoint != null, NOT_NULL_MSG, "endpoint URL");
|
||||
}
|
||||
|
||||
if (type == NodeType.GATEWAY && uplinkPort == null) {
|
||||
@ -480,7 +480,7 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
phyIntfs,
|
||||
controllers,
|
||||
auth,
|
||||
endPoint,
|
||||
endpoint,
|
||||
sshAuth,
|
||||
datapathType);
|
||||
}
|
||||
@ -554,8 +554,8 @@ public class DefaultOpenstackNode implements OpenstackNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder endPoint(String endPoint) {
|
||||
this.endPoint = endPoint;
|
||||
public Builder endpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ -44,13 +44,6 @@ public interface OpenstackAuth {
|
||||
*/
|
||||
String version();
|
||||
|
||||
/**
|
||||
* Returns the keystone authentication port number.
|
||||
*
|
||||
* @return keystone authentication port number
|
||||
*/
|
||||
Integer port();
|
||||
|
||||
/**
|
||||
* Returns the keystone authentication protocol type.
|
||||
*
|
||||
@ -106,14 +99,6 @@ public interface OpenstackAuth {
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
||||
@ -221,7 +221,7 @@ public interface OpenstackNode {
|
||||
*
|
||||
* @return keystone authentication info
|
||||
*/
|
||||
String endPoint();
|
||||
String endpoint();
|
||||
|
||||
/**
|
||||
* Returns a collection of customized controllers.
|
||||
@ -340,10 +340,10 @@ public interface OpenstackNode {
|
||||
/**
|
||||
* Returns openstack node builder with supplied endpoint info.
|
||||
*
|
||||
* @param endPoint endpoint info
|
||||
* @param endpoint endpoint info
|
||||
* @return openstack node builder
|
||||
*/
|
||||
Builder endPoint(String endPoint);
|
||||
Builder endpoint(String endpoint);
|
||||
|
||||
/**
|
||||
* Returns openstack node builder with supplied ssh authentication info.
|
||||
|
||||
@ -140,7 +140,7 @@ public class OpenstackNodeAdapter implements OpenstackNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String endPoint() {
|
||||
public String endpoint() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ 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";
|
||||
@ -50,7 +49,6 @@ public class OpenstackAuthCodec extends JsonCodec<OpenstackAuth> {
|
||||
|
||||
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())
|
||||
@ -71,8 +69,6 @@ public class OpenstackAuthCodec extends JsonCodec<OpenstackAuth> {
|
||||
|
||||
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(),
|
||||
@ -84,7 +80,6 @@ public class OpenstackAuthCodec extends JsonCodec<OpenstackAuth> {
|
||||
|
||||
DefaultOpenstackAuth.Builder authBuilder = DefaultOpenstackAuth.builder()
|
||||
.version(version)
|
||||
.port(port)
|
||||
.protocol(OpenstackAuth.Protocol.valueOf(protocol))
|
||||
.username(username)
|
||||
.password(password)
|
||||
|
||||
@ -59,7 +59,7 @@ public final class OpenstackNodeCodec extends JsonCodec<OpenstackNode> {
|
||||
private static final String PHYSICAL_INTERFACES = "phyIntfs";
|
||||
private static final String CONTROLLERS = "controllers";
|
||||
private static final String AUTHENTICATION = "authentication";
|
||||
private static final String END_POINT = "endPoint";
|
||||
private static final String END_POINT = "endpoint";
|
||||
private static final String SSH_AUTH = "sshAuth";
|
||||
private static final String DATA_PATH_TYPE = "datapathType";
|
||||
|
||||
@ -84,7 +84,7 @@ public final class OpenstackNodeCodec extends JsonCodec<OpenstackNode> {
|
||||
}
|
||||
|
||||
if (type == OpenstackNode.NodeType.CONTROLLER) {
|
||||
result.put(END_POINT, node.endPoint());
|
||||
result.put(END_POINT, node.endpoint());
|
||||
}
|
||||
|
||||
if (node.intgBridge() != null) {
|
||||
@ -156,7 +156,7 @@ public final class OpenstackNodeCodec extends JsonCodec<OpenstackNode> {
|
||||
if (type.equals(CONTROLLER)) {
|
||||
String endPoint = nullIsIllegal(json.get(END_POINT).asText(),
|
||||
END_POINT + MISSING_MESSAGE);
|
||||
nodeBuilder.endPoint(endPoint);
|
||||
nodeBuilder.endpoint(endPoint);
|
||||
}
|
||||
if (json.get(VLAN_INTF_NAME) != null) {
|
||||
nodeBuilder.vlanIntf(json.get(VLAN_INTF_NAME).asText());
|
||||
|
||||
@ -212,17 +212,7 @@ public final class OpenstackNodeUtil {
|
||||
StringBuilder endpointSb = new StringBuilder();
|
||||
endpointSb.append(auth.protocol().name().toLowerCase());
|
||||
endpointSb.append("://");
|
||||
endpointSb.append(node.endPoint());
|
||||
endpointSb.append(":");
|
||||
endpointSb.append(auth.port());
|
||||
endpointSb.append("/");
|
||||
|
||||
// in case the version is v3, we need to append identity path into endpoint
|
||||
if (auth.version().equals(KEYSTONE_V3)) {
|
||||
endpointSb.append(IDENTITY_PATH);
|
||||
}
|
||||
|
||||
endpointSb.append(auth.version());
|
||||
endpointSb.append(node.endpoint());
|
||||
return endpointSb.toString();
|
||||
}
|
||||
|
||||
|
||||
@ -50,14 +50,6 @@ public final class OpenstackAuthJsonMatcher extends TypeSafeDiagnosingMatcher<Js
|
||||
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();
|
||||
|
||||
@ -181,7 +181,6 @@ public class OpenstackNodeCodecTest {
|
||||
public void testOpenstackControllerNodeEncode() {
|
||||
OpenstackAuth auth = DefaultOpenstackAuth.builder()
|
||||
.version("v2.0")
|
||||
.port(35357)
|
||||
.protocol(OpenstackAuth.Protocol.HTTP)
|
||||
.project("admin")
|
||||
.username("admin")
|
||||
@ -194,7 +193,7 @@ public class OpenstackNodeCodecTest {
|
||||
.type(OpenstackNode.NodeType.CONTROLLER)
|
||||
.state(NodeState.INIT)
|
||||
.managementIp(IpAddress.valueOf("172.16.130.10"))
|
||||
.endPoint("keystone-end-point-url")
|
||||
.endpoint("keystone-end-point-url")
|
||||
.authentication(auth)
|
||||
.build();
|
||||
|
||||
@ -212,12 +211,11 @@ public class OpenstackNodeCodecTest {
|
||||
assertThat(node.hostname(), is("controller"));
|
||||
assertThat(node.type().name(), is("CONTROLLER"));
|
||||
assertThat(node.managementIp().toString(), is("172.16.130.10"));
|
||||
assertThat(node.endPoint(), is("keystone-end-point-url"));
|
||||
assertThat(node.endpoint(), is("keystone-end-point-url"));
|
||||
|
||||
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"));
|
||||
|
||||
@ -40,7 +40,7 @@ public final class OpenstackNodeJsonMatcher extends TypeSafeDiagnosingMatcher<Js
|
||||
private static final String PHYSICAL_INTERFACES = "phyIntfs";
|
||||
private static final String CONTROLLERS = "controllers";
|
||||
private static final String AUTHENTICATION = "authentication";
|
||||
private static final String END_POINT = "endPoint";
|
||||
private static final String END_POINT = "endpoint";
|
||||
private static final String SSH_AUTH = "sshAuth";
|
||||
private static final String DATA_PATH_TYPE = "datapathType";
|
||||
|
||||
@ -135,11 +135,11 @@ public final class OpenstackNodeJsonMatcher extends TypeSafeDiagnosingMatcher<Js
|
||||
}
|
||||
|
||||
// check endpoint URL
|
||||
JsonNode jsonEndPoint = jsonNode.get(END_POINT);
|
||||
if (jsonEndPoint != null) {
|
||||
String endPoint = node.endPoint();
|
||||
if (!jsonEndPoint.asText().equals(endPoint)) {
|
||||
description.appendText("endpoint URL was " + jsonEndPoint);
|
||||
JsonNode jsonEndpoint = jsonNode.get(END_POINT);
|
||||
if (jsonEndpoint != null) {
|
||||
String endpoint = node.endpoint();
|
||||
if (!jsonEndpoint.asText().equals(endpoint)) {
|
||||
description.appendText("endpoint URL was " + jsonEndpoint);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,24 +33,20 @@ public class DefaultOpenstackAuthTest {
|
||||
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);
|
||||
createOpenstackAuth(VERSION_1, PROTOCOL_1);
|
||||
private static final OpenstackAuth OS_AUTH_2 =
|
||||
createOpenstackAuth(VERSION_2, PORT_2, PROTOCOL_2);
|
||||
createOpenstackAuth(VERSION_2, PROTOCOL_2);
|
||||
private static final OpenstackAuth OS_AUTH_3 =
|
||||
createOpenstackAuth(VERSION_1, PORT_1, PROTOCOL_1);
|
||||
createOpenstackAuth(VERSION_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)
|
||||
@ -77,7 +73,6 @@ public class DefaultOpenstackAuthTest {
|
||||
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"));
|
||||
|
||||
@ -501,7 +501,7 @@ public class DefaultOpenstackNodeHandlerTest {
|
||||
Set<OpenstackPhyInterface> phyIntfs,
|
||||
Set<ControllerInfo> controllers,
|
||||
OpenstackAuth auth,
|
||||
String endPoint,
|
||||
String endpoint,
|
||||
OpenstackSshAuth sshAuth,
|
||||
DatapathType datapathType) {
|
||||
super(hostname,
|
||||
@ -515,7 +515,7 @@ public class DefaultOpenstackNodeHandlerTest {
|
||||
phyIntfs,
|
||||
controllers,
|
||||
auth,
|
||||
endPoint,
|
||||
endpoint,
|
||||
sshAuth,
|
||||
datapathType);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"hostname": "controller",
|
||||
"type": "CONTROLLER",
|
||||
"managementIp": "172.16.130.10",
|
||||
"endPoint": "keystone-end-point-url",
|
||||
"endpoint": "keystone-end-point-url",
|
||||
"authentication": {
|
||||
"version": "v2.0",
|
||||
"port": 35357,
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
"hostname" : "controller",
|
||||
"type" : "CONTROLLER",
|
||||
"managementIp" : "172.16.130.10",
|
||||
"endPoint" : "keystone-endpoint-url",
|
||||
"endpoint" : "keystone-endpoint-url",
|
||||
"authentication" : {
|
||||
"version" : "v2.0",
|
||||
"port" : 35357,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user