[
https://issues.apache.org/jira/browse/CLOUDSTACK-8832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14974976#comment-14974976
]
ASF GitHub Bot commented on CLOUDSTACK-8832:
--------------------------------------------
Github user jburwell commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/801#discussion_r43048038
--- Diff:
plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
---
@@ -152,50 +241,185 @@ public NuageVspDeviceVO
addNuageVspDevice(AddNuageVspDeviceCmd cmd) {
throw new CloudRuntimeException("A NuageVsp device is already
configured on this physical network");
}
- Map<String, String> params = new HashMap<String, String>();
- params.put("guid", UUID.randomUUID().toString());
- params.put("zoneId",
String.valueOf(physicalNetwork.getDataCenterId()));
- params.put("physicalNetworkId",
String.valueOf(physicalNetwork.getId()));
- params.put("name", "Nuage VSD - " + cmd.getHostName());
- params.put("hostname", cmd.getHostName());
- params.put("cmsuser", cmd.getUserName());
- String cmsUserPasswordBase64 =
org.apache.commons.codec.binary.StringUtils.newStringUtf8(Base64.encodeBase64(cmd.getPassword().getBytes(Charset.forName("UTF-8"))));
- params.put("cmsuserpass", cmsUserPasswordBase64);
- int port = cmd.getPort();
- if (0 == port) {
- port = 443;
- }
- params.put("port", String.valueOf(port));
- params.put("apirelativepath", "/nuage/api/" + cmd.getApiVersion());
- params.put("retrycount", String.valueOf(cmd.getApiRetryCount()));
- params.put("retryinterval",
String.valueOf(cmd.getApiRetryInterval()));
+ try {
+ NuageVspPluginClientLoader clientLoader =
NuageVspPluginClientLoader.getClientLoader(null, null, 1, 1, null);
- Map<String, Object> hostdetails = new HashMap<String, Object>();
- hostdetails.putAll(params);
+ Map<String, Object> clientDefaults =
clientLoader.getNuageVspManagerClient().getClientDefaults();
+ String apiVersion =
MoreObjects.firstNonNull(cmd.getApiVersion(), (String)
clientDefaults.get("CURRENT_API_VERSION"));
+ if
(!clientLoader.getNuageVspManagerClient().isSupportedApiVersion(apiVersion)) {
+ throw new CloudRuntimeException("Unsupported API version :
" + apiVersion);
+ }
- try {
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("guid", UUID.randomUUID().toString());
+ params.put("zoneId",
String.valueOf(physicalNetwork.getDataCenterId()));
+ params.put("physicalNetworkId",
String.valueOf(physicalNetwork.getId()));
+ params.put("name", "Nuage VSD - " + cmd.getHostName());
--- End diff --
This behavior feels like a leaky abstraction. Consider adding a method to
the command to encapsulate this behavior and ensure consistency across all
usages.
> Update Nuage VSP plugin to work with Nuage VSP release 3.2
> ----------------------------------------------------------
>
> Key: CLOUDSTACK-8832
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8832
> Project: CloudStack
> Issue Type: Improvement
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Management Server
> Affects Versions: 4.6.0
> Reporter: Nick Livens
> Assignee: Nick Livens
> Attachments: nuageVspMarvinLogs.tar.gz
>
>
> Nuage VSP 3.2 is being released, we want to bring the plugin up to date for
> this release
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)