You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2013/03/29 14:26:08 UTC
git commit: updated refs/heads/master to ee3fd18
Updated Branches:
refs/heads/master 690c31290 -> ee3fd1843
BigSwitch networking plugin update
Update BigSwitch Plugin:
. UI support for adding BigSwitch controller as a network service provider
. Correct the message format between the plugin and the controller
. Add Health check API
Test to add a BigSwitch controller as a network service provider and view.
Test to implementation of guest network on the controller
Test to associate VM to its guest network
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ee3fd184
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ee3fd184
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ee3fd184
Branch: refs/heads/master
Commit: ee3fd1843533528eb3872951730fee6e5802c348
Parents: 690c312
Author: Kanzhe Jiang <ka...@bigswitch.com>
Authored: Fri Mar 29 18:48:50 2013 +0530
Committer: Murali Reddy <mu...@citrix.com>
Committed: Fri Mar 29 18:54:48 2013 +0530
----------------------------------------------------------------------
.../WEB-INF/classes/resources/messages.properties | 4 +
client/tomcatconf/componentContext.xml.in | 13 +-
client/tomcatconf/nonossComponentContext.xml.in | 6 +
.../api/commands/DeleteBigSwitchVnsDeviceCmd.java | 4 +-
.../api/commands/ListBigSwitchVnsDevicesCmd.java | 8 +-
.../api/response/BigSwitchVnsDeviceResponse.java | 4 +
.../com/cloud/network/BigSwitchVnsDeviceVO.java | 4 +-
.../com/cloud/network/bigswitch/Attachment.java | 38 --
.../cloud/network/bigswitch/AttachmentData.java | 50 ++
.../cloud/network/bigswitch/BigSwitchVnsApi.java | 39 +-
.../network/bigswitch/ControlClusterStatus.java | 4 +
.../src/com/cloud/network/bigswitch/Network.java | 74 ---
.../com/cloud/network/bigswitch/NetworkData.java | 86 ++++
.../src/com/cloud/network/bigswitch/Port.java | 56 ---
.../src/com/cloud/network/bigswitch/PortData.java | 68 +++
.../cloud/network/element/BigSwitchVnsElement.java | 14 +-
.../network/guru/BigSwitchVnsGuestNetworkGuru.java | 4 +-
.../network/resource/BigSwitchVnsResource.java | 40 +-
.../cloud/network/bigswitch/BigSwitchApiTest.java | 18 +-
.../network/resource/BigSwitchVnsResourceTest.java | 44 ++-
ui/dictionary.jsp | 5 +-
ui/scripts/system.js | 373 ++++++++++++++-
22 files changed, 698 insertions(+), 258 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index da224eb..d62cbae 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1582,6 +1582,10 @@ label.nicira.controller.address=Controller Address
label.nicira.transportzoneuuid=Transport Zone Uuid
label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid
+label.add.BigSwitchVns.device=Add BigSwitch Vns Controller
+label.delete.BigSwitchVns=Remove BigSwitch Vns Controller
+label.bigswitch.controller.address=BigSwitch Vns Controller Address
+
#resizeVolumes
label.resize.new.size=New Size(GB)
label.action.resize.volume=Resize Volume
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 3f8277a..0b81016 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -107,12 +107,6 @@
<property name="name" value="NiciraNvp"/>
</bean>
-->
-
-<!--
- <bean id="BigSwitchVnsElementService" class="com.cloud.network.element.BigSwitchVnsElement">
- <property name="name" value="BigSwitchVnsElementService"/>
- </bean>
--->
<!--
Adapters
@@ -296,12 +290,9 @@
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
</bean>
-
-<!--
- <bean id="BigSwitchVnsGuestNetworkGuru" class=".BigSwitchVnsGuestNetworkGuru">
- <property name="name" value="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru"/>
+ <bean id="BigSwitchVnsGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru">
+ <property name="name" value="BigSwitchVnsGuestNetworkGuru"/>
</bean>
--->
<!--
Hypervisor Gurus
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index 97a4f28..6659e21 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -111,6 +111,9 @@
<bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement">
<property name="name" value="NiciraNvp"/>
</bean>
+ <bean id="BigSwitchVns" class="com.cloud.network.element.BigSwitchVnsElement">
+ <property name="name" value="BigSwitchVns"/>
+ </bean>
<bean id="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement">
<property name="name" value="JuniperSRX"/>
@@ -299,6 +302,9 @@
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
</bean>
+ <bean id="BigSwitchVnsGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru">
+ <property name="name" value="BigSwitchVnsGuestNetworkGuru"/>
+ </bean>
<!--
Hypervisor Gurus
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
index f26bdde..9a7dc48 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java
@@ -26,6 +26,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
+import com.cloud.api.response.BigSwitchVnsDeviceResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
@@ -44,7 +45,8 @@ public class DeleteBigSwitchVnsDeviceCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, type=CommandType.LONG, required=true, description="BigSwitch device ID")
+ @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, type=CommandType.UUID, entityType = BigSwitchVnsDeviceResponse.class,
+ required=true, description="BigSwitch device ID")
private Long bigswitchVnsDeviceId;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
index 002d750..490fb1e 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java
@@ -52,13 +52,13 @@ public class ListBigSwitchVnsDevicesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID,
- entityType = PhysicalNetworkResponse.class,
+ entityType = PhysicalNetworkResponse.class,
description="the Physical Network ID")
private Long physicalNetworkId;
- @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID,
- type=CommandType.LONG,
- description="bigswitch vns device ID")
+ @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, type=CommandType.UUID,
+ entityType = BigSwitchVnsDeviceResponse.class,
+ description="bigswitch vns device ID")
private Long bigswitchVnsDeviceId;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
index ede5adf..07b28cc 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java
@@ -41,6 +41,10 @@ public class BigSwitchVnsDeviceResponse extends BaseResponse {
@SerializedName(ApiConstants.HOST_NAME) @Param(description="the controller Ip address")
private String hostName;
+ public String getId() {
+ return this.id;
+ }
+
public void setId(String vnsDeviceId) {
this.id = vnsDeviceId;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
index 7e64833..7e7847a 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java
@@ -25,9 +25,11 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import org.apache.cloudstack.api.InternalIdentity;
+
@Entity
@Table(name="external_bigswitch_vns_devices")
-public class BigSwitchVnsDeviceVO {
+public class BigSwitchVnsDeviceVO implements InternalIdentity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java
deleted file mode 100644
index 9a13467..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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 com.cloud.network.bigswitch;
-
-public class Attachment {
- private String id;
- private String mac;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getMac() {
- return mac;
- }
-
- public void setMac(String mac) {
- this.mac = mac;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
new file mode 100644
index 0000000..581e30a
--- /dev/null
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/AttachmentData.java
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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 com.cloud.network.bigswitch;
+
+public class AttachmentData {
+ private Attachment attachment;
+
+ public Attachment getAttachment() {
+ return attachment;
+ }
+
+ public AttachmentData() {
+ this.attachment = new Attachment();
+ }
+
+ public class Attachment {
+ private String id;
+ private String mac;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getMac() {
+ return mac;
+ }
+
+ public void setMac(String mac) {
+ this.mac = mac;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
index c409dce..2002790 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java
@@ -49,10 +49,10 @@ public class BigSwitchVnsApi {
private static final Logger s_logger = Logger.getLogger(BigSwitchVnsApi.class);
private final static String _protocol = "http";
private final static String _nsBaseUri = "/networkService/v1.1";
- private final static String _controllerBaseUri = "/wm/core";
private final static String CONTENT_TYPE = "Content-Type";
+ private final static String ACCEPT = "Accept";
private final static String CONTENT_JSON = "application/json";
- private final static String HTTP_HEADER_INSTANCE_ID = "HTTP_INSTANCE_ID";
+ private final static String HTTP_HEADER_INSTANCE_ID = "INSTANCE_ID";
private final static String CLOUDSTACK_INSTANCE_ID = "org.apache.cloudstack";
private final static MultiThreadedHttpConnectionManager s_httpClientManager =
new MultiThreadedHttpConnectionManager();
@@ -114,55 +114,56 @@ public class BigSwitchVnsApi {
return;
}
- public void createNetwork(Network network)
+ public void createNetwork(NetworkData network)
throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + network.getTenant_id() + "/network";
- executeCreateObject(network, new TypeToken<Network>(){}.getType(),
+ String uri = _nsBaseUri + "/tenants/" + network.getNetwork().getTenant_id() + "/networks";
+ executeCreateObject(network, new TypeToken<NetworkData>(){}.getType(),
uri, Collections.<String,String>emptyMap());
}
public void deleteNetwork(String tenantId, String networkId) throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId;
+ String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId;
executeDeleteObject(uri);
}
- public void createPort(String networkUuid, Port port)
+ public void createPort(String networkUuid, PortData port)
throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + port.getTenant_id() + "/networks/" + networkUuid + "/ports";
- executeCreateObject(port, new TypeToken<Port>(){}.getType(),
+ String uri = _nsBaseUri + "/tenants/" + port.getPort().getTenant_id() + "/networks/" + networkUuid + "/ports";
+ executeCreateObject(port, new TypeToken<PortData>(){}.getType(),
uri, Collections.<String,String>emptyMap());
}
- public void modifyPort(String networkId, Port port)
+ public void modifyPort(String networkId, PortData port)
throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + port.getTenant_id() + "/networks/" + networkId + "/ports";
+ String uri = _nsBaseUri + "/tenants/" + port.getPort().getTenant_id() + "/networks/" + networkId + "/ports";
executeUpdateObject(port, uri, Collections.<String,String>emptyMap());
}
public void deletePort(String tenantId, String networkId, String portId)
throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId;
+ String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId;
executeDeleteObject(uri);
}
public void modifyPortAttachment(String tenantId,
String networkId,
String portId,
- Attachment attachment) throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
+ AttachmentData attachment) throws BigSwitchVnsApiException {
+ String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
}
public void deletePortAttachment(String tenantId, String networkId, String portId)
throws BigSwitchVnsApiException {
- String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
+ String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
executeDeleteObject(uri);
}
public ControlClusterStatus getControlClusterStatus() throws BigSwitchVnsApiException {
- String uri = _controllerBaseUri + "/health/json";
+ String uri = _nsBaseUri + "/health";
ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>(){}.getType(),
uri, 80, null);
+ ccs.setStatus(true);
return ccs;
}
@@ -177,6 +178,7 @@ public class BigSwitchVnsApi {
PutMethod pm = (PutMethod) createMethod("put", uri, 80);
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
+ pm.setRequestHeader(ACCEPT, CONTENT_JSON);
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
try {
pm.setRequestEntity(new StringRequestEntity(
@@ -207,6 +209,7 @@ public class BigSwitchVnsApi {
PostMethod pm = (PostMethod) createMethod("post", uri, 80);
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
+ pm.setRequestHeader(ACCEPT, CONTENT_JSON);
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
try {
pm.setRequestEntity(new StringRequestEntity(
@@ -235,6 +238,7 @@ public class BigSwitchVnsApi {
DeleteMethod dm = (DeleteMethod) createMethod("delete", uri, 80);
dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
+ dm.setRequestHeader(ACCEPT, CONTENT_JSON);
dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
executeMethod(dm);
@@ -257,6 +261,7 @@ public class BigSwitchVnsApi {
GetMethod gm = (GetMethod) createMethod("get", uri, port);
gm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
+ gm.setRequestHeader(ACCEPT, CONTENT_JSON);
gm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
if (parameters != null && !parameters.isEmpty()) {
@@ -327,4 +332,4 @@ public class BigSwitchVnsApi {
return method.getStatusText();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
index 9181afd..501b322 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java
@@ -22,4 +22,8 @@ public class ControlClusterStatus {
public boolean getStatus() {
return healthy;
}
+
+ public void setStatus(boolean status) {
+ this.healthy = status;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java
deleted file mode 100644
index c89c693..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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 com.cloud.network.bigswitch;
-
-public class Network {
- private String id;
- private String name;
- private String tenant_id;
- private int vlan;
- private String gateway;
- private String state;
-
- public String getUuid() {
- return id;
- }
-
- public void setUuid(String id) {
- this.id = id;
- }
-
- public String getDisplay_name() {
- return name;
- }
-
- public void setDisplay_name(String display_name) {
- this.name = display_name;
- }
-
- public String getTenant_id() {
- return tenant_id;
- }
-
- public void setTenant_id(String tenant_id) {
- this.tenant_id = tenant_id;
- }
-
- public int getVlan() {
- return vlan;
- }
-
- public void setVlan(int vlan) {
- this.vlan = vlan;
- }
-
- public String getGateway() {
- return gateway;
- }
-
- public void setGateway(String gateway) {
- this.gateway = gateway;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
new file mode 100644
index 0000000..2fa53cf
--- /dev/null
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/NetworkData.java
@@ -0,0 +1,86 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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 com.cloud.network.bigswitch;
+
+public class NetworkData {
+ private Network network;
+
+ public Network getNetwork() {
+ return this.network;
+ }
+
+ public NetworkData() {
+ this.network = new Network();
+ }
+
+ public class Network {
+ private String id;
+ private String name;
+ private String tenant_id;
+ private int vlan;
+ private String gateway;
+ private String state;
+
+ public String getUuid() {
+ return id;
+ }
+
+ public void setUuid(String id) {
+ this.id = id;
+ }
+
+ public String getDisplay_name() {
+ return name;
+ }
+
+ public void setDisplay_name(String display_name) {
+ this.name = display_name;
+ }
+
+ public String getTenant_id() {
+ return tenant_id;
+ }
+
+ public void setTenant_id(String tenant_id) {
+ this.tenant_id = tenant_id;
+ }
+
+ public int getVlan() {
+ return vlan;
+ }
+
+ public void setVlan(int vlan) {
+ this.vlan = vlan;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public void setGateway(String gateway) {
+ this.gateway = gateway;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java
deleted file mode 100644
index bf749d0..0000000
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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 com.cloud.network.bigswitch;
-
-public class Port {
- private String id;
- private String name;
- private String tenant_id;
- private String state;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getTenant_id() {
- return tenant_id;
- }
-
- public void setTenant_id(String tenant_id) {
- this.tenant_id = tenant_id;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
new file mode 100644
index 0000000..25f6f0a
--- /dev/null
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/PortData.java
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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 com.cloud.network.bigswitch;
+
+public class PortData {
+ private Port port;
+
+ public Port getPort() {
+ return this.port;
+ }
+
+ public PortData() {
+ this.port = new Port();
+ }
+
+ public class Port {
+ private String id;
+ private String name;
+ private String tenant_id;
+ private String state;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTenant_id() {
+ return tenant_id;
+ }
+
+ public void setTenant_id(String tenant_id) {
+ this.tenant_id = tenant_id;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
index 95c9e18..4ee9c93 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java
@@ -76,7 +76,6 @@ import com.cloud.network.dao.PhysicalNetworkVO;
import com.cloud.network.resource.BigSwitchVnsResource;
import com.cloud.offering.NetworkOffering;
import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ResourceState;
import com.cloud.resource.ResourceStateAdapter;
import com.cloud.resource.ServerResource;
import com.cloud.resource.UnableDeleteHostException;
@@ -139,7 +138,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) {
return false;
}
-
+/*
if (!_networkModel.isProviderForNetwork(getProvider(),
network.getId())) {
s_logger.debug("BigSwitchVnsElement is not a provider for network "
@@ -154,7 +153,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
+ network.getDisplayText());
return false;
}
-
+*/
return true;
}
@@ -198,7 +197,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
}
String mac = nic.getMacAddress();
- String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
+ String tenantId = context.getDomain().getName();
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
@@ -242,7 +241,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
return false;
}
- String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
+ String tenantId = context.getDomain().getName();
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
.listByPhysicalNetwork(network.getPhysicalNetworkId());
@@ -462,8 +461,9 @@ public class BigSwitchVnsElement extends AdapterBase implements
HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
Long hostId = bigswitchHost.getId();
- bigswitchHost.setResourceState(ResourceState.Maintenance);
- _hostDao.update(hostId, bigswitchHost);
+ //bigswitchHost.setResourceState(ResourceState.Maintenance);
+ //_hostDao.update(hostId, bigswitchHost);
+ _hostDao.remove(hostId);
_resourceMgr.deleteHost(hostId, false, false);
_bigswitchVnsDao.remove(bigswitchVnsDeviceId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
index b96ea56..e753b13 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
@@ -179,7 +179,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
name = name.substring(0, 63); // max length 64
}
- String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
+ String tenantId = context.getDomain().getName();
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
if (devices.isEmpty()) {
s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
@@ -244,7 +244,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
- String tenantId = profile.getNetworkDomain() + "-" + profile.getAccountId();
+ String tenantId = profile.getNetworkDomain();
DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId,
networkObject.getBroadcastUri().getSchemeSpecificPart());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
index 8d070b5..761272d 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java
@@ -47,9 +47,9 @@ import com.cloud.host.Host.Type;
import com.cloud.network.bigswitch.BigSwitchVnsApi;
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
import com.cloud.network.bigswitch.ControlClusterStatus;
-import com.cloud.network.bigswitch.Attachment;
-import com.cloud.network.bigswitch.Network;
-import com.cloud.network.bigswitch.Port;
+import com.cloud.network.bigswitch.AttachmentData;
+import com.cloud.network.bigswitch.NetworkData;
+import com.cloud.network.bigswitch.PortData;
import com.cloud.resource.ServerResource;
import com.cloud.utils.component.ManagerBase;
@@ -193,15 +193,15 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
}
private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) {
- Network network = new Network();
- network.setTenant_id(cmd.getTenantUuid());
- network.setUuid(cmd.getNetworkUuid());
- network.setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
- network.setVlan(cmd.getVlan());
+ NetworkData network = new NetworkData();
+ network.getNetwork().setTenant_id(cmd.getTenantUuid());
+ network.getNetwork().setUuid(cmd.getNetworkUuid());
+ network.getNetwork().setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
+ network.getNetwork().setVlan(cmd.getVlan());
try {
_bigswitchVnsApi.createNetwork(network);
- return new CreateVnsNetworkAnswer(cmd, true, "VNS " + network.getUuid() + " created");
+ return new CreateVnsNetworkAnswer(cmd, true, "VNS " + network.getNetwork().getUuid() + " created");
} catch (BigSwitchVnsApiException e) {
if (numRetries > 0) {
return retry(cmd, --numRetries);
@@ -228,17 +228,17 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
}
private Answer executeRequest(CreateVnsPortCommand cmd, int numRetries) {
- Port port = new Port();
- port.setId(cmd.getPortUuid());
- port.setName(cmd.getPortName());
- port.setTenant_id(cmd.getTenantUuid());
+ PortData port = new PortData();
+ port.getPort().setId(cmd.getPortUuid());
+ port.getPort().setName(cmd.getPortName());
+ port.getPort().setTenant_id(cmd.getTenantUuid());
try {
_bigswitchVnsApi.createPort(cmd.getNetworkUuid(), port);
try {
- Attachment attachment = new Attachment();
- attachment.setId(cmd.getPortUuid());
- attachment.setMac(cmd.getMac());
+ AttachmentData attachment = new AttachmentData();
+ attachment.getAttachment().setId(cmd.getPortUuid());
+ attachment.getAttachment().setMac(cmd.getMac());
_bigswitchVnsApi.modifyPortAttachment(cmd.getTenantUuid(),
cmd.getNetworkUuid(), cmd.getPortUuid(), attachment);
@@ -279,10 +279,10 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
}
private Answer executeRequest(UpdateVnsPortCommand cmd, int numRetries) {
- Port port = new Port();
- port.setId(cmd.getPortUuid());
- port.setName(cmd.getPortName());
- port.setTenant_id(cmd.getTenantUuid());
+ PortData port = new PortData();
+ port.getPort().setId(cmd.getPortUuid());
+ port.getPort().setName(cmd.getPortName());
+ port.getPort().setTenant_id(cmd.getTenantUuid());
try {
_bigswitchVnsApi.modifyPort(cmd.getNetworkUuid(), port);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
index cab06ba..5b3bcc1 100644
--- a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
+++ b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java
@@ -98,10 +98,10 @@ public class BigSwitchApiTest {
@Test
public void testExecuteCreateObject() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
_method = mock(PostMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
- _api.executeCreateObject(network, Network.class, "/", Collections.<String, String> emptyMap());
+ _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
verify(_method, times(1)).releaseConnection();
}
@@ -109,7 +109,7 @@ public class BigSwitchApiTest {
@Test (expected=BigSwitchVnsApiException.class)
public void testExecuteCreateObjectFailure() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
_method = mock(PostMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
@@ -118,7 +118,7 @@ public class BigSwitchApiTest {
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
when(_method.isRequestSent()).thenReturn(true);
try {
- _api.executeCreateObject(network, Network.class, "/", Collections.<String, String> emptyMap());
+ _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
} finally {
verify(_method, times(1)).releaseConnection();
}
@@ -127,7 +127,7 @@ public class BigSwitchApiTest {
@Test (expected=BigSwitchVnsApiException.class)
public void testExecuteCreateObjectException() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
_method = mock(PostMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
@@ -136,7 +136,7 @@ public class BigSwitchApiTest {
when(_method.getResponseHeader("Content-Type")).thenReturn(header);
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
try {
- _api.executeCreateObject(network, Network.class, "/", Collections.<String, String> emptyMap());
+ _api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
} finally {
verify(_method, times(1)).releaseConnection();
}
@@ -145,7 +145,7 @@ public class BigSwitchApiTest {
@Test
public void testExecuteUpdateObject() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
_method = mock(PutMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
_api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
@@ -156,7 +156,7 @@ public class BigSwitchApiTest {
@Test (expected=BigSwitchVnsApiException.class)
public void testExecuteUpdateObjectFailure() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
_method = mock(PutMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
Header header = mock(Header.class);
@@ -174,7 +174,7 @@ public class BigSwitchApiTest {
@Test (expected=BigSwitchVnsApiException.class)
public void testExecuteUpdateObjectException() throws BigSwitchVnsApiException, IOException {
_api.setControllerAddress("10.10.0.10");
- Network network = new Network();
+ NetworkData network = new NetworkData();
_method = mock(PutMethod.class);
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
index 514385f..aadb7e0 100644
--- a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
+++ b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java
@@ -41,10 +41,10 @@ import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.UpdateVnsPortAnswer;
import com.cloud.agent.api.UpdateVnsPortCommand;
import com.cloud.host.Host;
-import com.cloud.network.bigswitch.Attachment;
+import com.cloud.network.bigswitch.AttachmentData;
import com.cloud.network.bigswitch.ControlClusterStatus;
-import com.cloud.network.bigswitch.Network;
-import com.cloud.network.bigswitch.Port;
+import com.cloud.network.bigswitch.NetworkData;
+import com.cloud.network.bigswitch.PortData;
import com.cloud.network.bigswitch.BigSwitchVnsApi;
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
@@ -140,7 +140,9 @@ public class BigSwitchVnsResourceTest {
public void testRetries() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Network network = mock(Network.class);
+ NetworkData networkdata = mock(NetworkData.class);
+ NetworkData.Network network = mock(NetworkData.Network.class);
+ when(networkdata.getNetwork()).thenReturn(network);
when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
@@ -152,7 +154,9 @@ public class BigSwitchVnsResourceTest {
public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Network network = mock(Network.class);
+ NetworkData networkdata = mock(NetworkData.class);
+ NetworkData.Network network = mock(NetworkData.Network.class);
+ when(networkdata.getNetwork()).thenReturn(network);
when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
@@ -164,9 +168,11 @@ public class BigSwitchVnsResourceTest {
public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Network network = mock(Network.class);
+ NetworkData networkdata = mock(NetworkData.class);
+ NetworkData.Network network = mock(NetworkData.Network.class);
+ when(networkdata.getNetwork()).thenReturn(network);
when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
- doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createNetwork((Network)any());
+ doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createNetwork((NetworkData)any());
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
@@ -197,8 +203,10 @@ public class BigSwitchVnsResourceTest {
public void testCreatePort() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Port networkp = mock(Port.class);
- when(networkp.getId()).thenReturn("eeee");
+ PortData portdata = mock(PortData.class);
+ PortData.Port port = mock(PortData.Port.class);
+ when(portdata.getPort()).thenReturn(port);
+ when(port.getId()).thenReturn("eeee");
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
@@ -209,9 +217,11 @@ public class BigSwitchVnsResourceTest {
public void testCreatePortApiExceptionInCreate() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Port networkp = mock(Port.class);
- when(networkp.getId()).thenReturn("eeee");
- doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (Port)any());
+ PortData portdata = mock(PortData.class);
+ PortData.Port port = mock(PortData.Port.class);
+ when(portdata.getPort()).thenReturn(port);
+ when(port.getId()).thenReturn("eeee");
+ doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (PortData)any());
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
@@ -222,9 +232,11 @@ public class BigSwitchVnsResourceTest {
public void testCreatePortApiExceptionInModify() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- Port networkp = mock(Port.class);
- when(networkp.getId()).thenReturn("eeee");
- doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (Attachment)any());
+ PortData portdata = mock(PortData.class);
+ PortData.Port port = mock(PortData.Port.class);
+ when(portdata.getPort()).thenReturn(port);
+ when(port.getId()).thenReturn("eeee");
+ doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (AttachmentData)any());
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
@@ -246,7 +258,7 @@ public class BigSwitchVnsResourceTest {
public void testUpdatePortException() throws ConfigurationException, BigSwitchVnsApiException {
_resource.configure("BigSwitchVnsResource", _parameters);
- doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPort((String) any(), (Port)any());
+ doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPort((String) any(), (PortData)any());
UpdateVnsPortAnswer dntkpa = (UpdateVnsPortAnswer) _resource.executeRequest(
new UpdateVnsPortCommand("networkId","portId","tenantId","portname"));
assertFalse(dntkpa.getResult());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index d4f9078..11e98cf 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1470,6 +1470,9 @@ dictionary = {
'label.action.vmsnapshot.delete': '<fmt:message key="label.action.vmsnapshot.delete" />',
'label.action.vmsnapshot.revert': '<fmt:message key="label.action.vmsnapshot.revert" />',
'message.action.vmsnapshot.delete': '<fmt:message key="message.action.vmsnapshot.delete" />',
-'message.action.vmsnapshot.revert': '<fmt:message key="message.action.vmsnapshot.revert" />'
+'message.action.vmsnapshot.revert': '<fmt:message key="message.action.vmsnapshot.revert" />',
+'label.add.BigSwitchVns.device': '<fmt:message key="label.add.BigSwitchVns.device" />',
+'label.delete.BigSwitchVns': '<fmt:message key="label.delete.BigSwitchVns" />',
+'label.bigswitch.controller.address': '<fmt:message key="label.bigswitch.controller.address" />'
};
</script>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee3fd184/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 8c5a6bb..9d6c476 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -4109,6 +4109,199 @@
notification: { poll: pollAsyncJobResult }
}
}
+ },
+ // BigSwitch Vns provider detail view
+ bigswitchVns: {
+ type: 'detailView',
+ id: 'bigswitchVnsProvider',
+ label: 'label.bigswitchVns',
+ viewAll: { label: 'label.devices', path: '_zone.bigswitchVnsDevices' },
+ tabs: {
+ details: {
+ title: 'label.details',
+ fields: [
+ {
+ name: { label: 'label.name' }
+ },
+ {
+ state: { label: 'label.state' }
+ }
+ ],
+ dataProvider: function(args) {
+ refreshNspData("BigSwitchVns");
+ var providerObj;
+ $(nspHardcodingArray).each(function(){
+ if(this.id == "bigswitchVns") {
+ providerObj = this;
+ return false;
+ }
+ });
+ args.response.success({
+ data: providerObj,
+ actionFilter: networkProviderActionFilter('bigswitchVns')
+ });
+ }
+ }
+ },
+ actions: {
+ add: {
+ label: 'label.add.BigSwitchVns.device',
+ createForm: {
+ title: 'label.add.BigSwitchVns.device',
+ preFilter: function(args) { },
+ fields: {
+ host: {
+ label: 'label.ip.address'
+ },
+ numretries: {
+ label: 'label.numretries',
+ defaultValue: '2'
+ },
+ }
+ },
+ action: function(args) {
+ if(nspMap["bigswitchVns"] == null) {
+ $.ajax({
+ url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var jobId = json.addnetworkserviceproviderresponse.jobid;
+ var addBigSwitchVnsProviderIntervalID = setInterval(function() {
+ $.ajax({
+ url: createURL("queryAsyncJobResult&jobId="+jobId),
+ dataType: "json",
+ success: function(json) {
+ var result = json.queryasyncjobresultresponse;
+ if (result.jobstatus == 0) {
+ return; //Job has not completed
+ }
+ else {
+ clearInterval(addBigSwitchVnsProviderIntervalID);
+ if (result.jobstatus == 1) {
+ nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
+ addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+ }
+ else if (result.jobstatus == 2) {
+ alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
+ }
+ }
+ },
+ error: function(XMLHttpResponse) {
+ var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+ alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
+ }
+ });
+ }, 3000);
+ }
+ });
+ }
+ else {
+ addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+ }
+ },
+ messages: {
+ notification: function(args) {
+ return 'label.add.BigSwitchVns.device';
+ }
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ },
+ enable: {
+ label: 'label.enable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Enabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.enable.provider';
+ },
+ notification: function() {
+ return 'label.enable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ },
+ disable: {
+ label: 'label.disable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Disabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.disable.provider';
+ },
+ notification: function() {
+ return 'label.disable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ },
+ destroy: {
+ label: 'label.shutdown.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("deleteNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.deletenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid
+ }
+ }
+ );
+
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.shutdown.provider';
+ },
+ notification: function(args) {
+ return 'label.shutdown.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ }
+ }
}
}
}
@@ -6914,6 +7107,152 @@
}
}
},
+ bigswitchVnsDevices: {
+ id: 'bigswitchVnsDevices',
+ title: 'label.devices',
+ listView: {
+ id: 'bigswitchVnsDevices',
+ fields: {
+ hostname: { label: 'label.bigswitch.controller.address' },
+ },
+ actions: {
+ add: {
+ label: 'label.add.BigSwitchVns.device',
+ createForm: {
+ title: 'label.add.BigSwitchVns.device',
+ preFilter: function(args) { },
+ fields: {
+ host: {
+ label: 'label.ip.address'
+ },
+ numretries: {
+ label: 'label.numretries',
+ defaultValue: '2'
+ },
+ }
+ },
+ action: function(args) {
+ if(nspMap["bigswitchVns"] == null) {
+ $.ajax({
+ url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var jobId = json.addnetworkserviceproviderresponse.jobid;
+ var addBigSwitchVnsProviderIntervalID = setInterval(function() {
+ $.ajax({
+ url: createURL("queryAsyncJobResult&jobId="+jobId),
+ dataType: "json",
+ success: function(json) {
+ var result = json.queryasyncjobresultresponse;
+ if (result.jobstatus == 0) {
+ return;
+ }
+ else {
+ clearInterval(addBigSwitchVnsProviderIntervalID);
+ if (result.jobstatus == 1) {
+ nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
+ addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+ }
+ else if (result.jobstatus == 2) {
+ alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext));
+ }
+ }
+ },
+ error: function(XMLHttpResponse) {
+ var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+ alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg);
+ }
+ });
+ }, 3000);
+ }
+ });
+ }
+ else {
+ addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice")
+ }
+ },
+
+ messages: {
+ notification: function(args) {
+ return 'Added new BigSwitch Vns Controller';
+ }
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listBigSwitchVnsDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id),
+ data: { page: args.page, pageSize: pageSize },
+ dataType: "json",
+ async: false,
+ success: function(json) {
+ var items = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice;
+ args.response.success({data: items});
+ }
+ });
+ },
+ detailView: {
+ name: 'BigSwitch Vns details',
+ actions: {
+ 'remove': {
+ label: 'label.delete.BigSwitchVns',
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.delete.BigSwitchVns';
+ },
+ notification: function(args) {
+ return 'label.delete.BigSwitchVns';
+ }
+ },
+ action: function(args) {
+ $.ajax({
+ url: createURL("deleteBigSwitchVnsDevice&vnsdeviceid=" + args.context.bigswitchvnsDevices[0].vnsdeviceid),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var jid = json.deletebigswitchvnsdeviceresponse.jobid;
+ args.response.success(
+ {_custom:
+ {jobId: jid}
+ }
+ );
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
+ tabs: {
+ details: {
+ title: 'label.details',
+ fields: [
+ {
+ vnsdeviceid: { label: 'label.id' },
+ hostname: { label: 'label.ip.address' },
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listBigSwitchVnsDevices&vnsdeviceid=" + args.context.bigswitchVnsDevices[0].vnsdeviceid),
+ dataType: "json",
+ async: true,
+ success: function(json) {
+ var item = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice[0];
+ args.response.success({data: item});
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ },
pods: {
title: 'label.pods',
listView: {
@@ -10397,6 +10736,30 @@
});
}
+ function addBigSwitchVnsDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) {
+ var array1 = [];
+ array1.push("&physicalnetworkid=" + physicalNetworkObj.id);
+ array1.push("&hostname=" + todb(args.data.host));
+
+ $.ajax({
+ url: createURL(apiCmd + array1.join("")),
+ dataType: "json",
+ success: function(json) {
+ var jid = json[apiCmdRes].jobid;
+ args.response.success(
+ {_custom:
+ {jobId: jid,
+ getUpdatedItem: function(json) {
+ var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj];
+
+ return item;
+ }
+ }
+ }
+ );
+ }
+ });
+ }
var afterCreateZonePhysicalNetworkTrafficTypes = function(args, newZoneObj, newPhysicalnetwork) {
$.ajax({
@@ -10982,6 +11345,9 @@
case "NiciraNvp":
nspMap["niciraNvp"] = items[i];
break;
+ case "BigSwitchVns":
+ nspMap["bigswitchVns"] = items[i];
+ break;
}
}
}
@@ -11003,7 +11369,12 @@
id: 'niciraNvp',
name: 'Nicira Nvp',
state: nspMap.niciraNvp ? nspMap.niciraNvp.state : 'Disabled'
- }
+ },
+ {
+ id: 'bigswitchVns',
+ name: 'BigSwitch Vns',
+ state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state : 'Disabled'
+ }
];
if(selectedZoneObj.networktype == "Basic") {