mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
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
This commit is contained in:
parent
690c31290b
commit
ee3fd18435
@ -1582,6 +1582,10 @@ label.nicira.controller.address=Controller Address
|
|||||||
label.nicira.transportzoneuuid=Transport Zone Uuid
|
label.nicira.transportzoneuuid=Transport Zone Uuid
|
||||||
label.nicira.l3gatewayserviceuuid=L3 Gateway Service 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
|
#resizeVolumes
|
||||||
label.resize.new.size=New Size(GB)
|
label.resize.new.size=New Size(GB)
|
||||||
label.action.resize.volume=Resize Volume
|
label.action.resize.volume=Resize Volume
|
||||||
|
|||||||
@ -108,12 +108,6 @@
|
|||||||
</bean>
|
</bean>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!--
|
|
||||||
<bean id="BigSwitchVnsElementService" class="com.cloud.network.element.BigSwitchVnsElement">
|
|
||||||
<property name="name" value="BigSwitchVnsElementService"/>
|
|
||||||
</bean>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Adapters
|
Adapters
|
||||||
-->
|
-->
|
||||||
@ -296,12 +290,9 @@
|
|||||||
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
|
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
|
||||||
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
|
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="BigSwitchVnsGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru">
|
||||||
<!--
|
<property name="name" value="BigSwitchVnsGuestNetworkGuru"/>
|
||||||
<bean id="BigSwitchVnsGuestNetworkGuru" class=".BigSwitchVnsGuestNetworkGuru">
|
|
||||||
<property name="name" value="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Hypervisor Gurus
|
Hypervisor Gurus
|
||||||
|
|||||||
@ -111,6 +111,9 @@
|
|||||||
<bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement">
|
<bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement">
|
||||||
<property name="name" value="NiciraNvp"/>
|
<property name="name" value="NiciraNvp"/>
|
||||||
</bean>
|
</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">
|
<bean id="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement">
|
||||||
<property name="name" value="JuniperSRX"/>
|
<property name="name" value="JuniperSRX"/>
|
||||||
@ -299,6 +302,9 @@
|
|||||||
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
|
<bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
|
||||||
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
|
<property name="name" value="NiciraNvpGuestNetworkGuru"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="BigSwitchVnsGuestNetworkGuru" class="com.cloud.network.guru.BigSwitchVnsGuestNetworkGuru">
|
||||||
|
<property name="name" value="BigSwitchVnsGuestNetworkGuru"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Hypervisor Gurus
|
Hypervisor Gurus
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||||
|
|
||||||
|
import com.cloud.api.response.BigSwitchVnsDeviceResponse;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
@ -44,7 +45,8 @@ public class DeleteBigSwitchVnsDeviceCmd extends BaseAsyncCmd {
|
|||||||
//////////////// API parameters /////////////////////
|
//////////////// 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;
|
private Long bigswitchVnsDeviceId;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -56,8 +56,8 @@ public class ListBigSwitchVnsDevicesCmd extends BaseListCmd {
|
|||||||
description="the Physical Network ID")
|
description="the Physical Network ID")
|
||||||
private Long physicalNetworkId;
|
private Long physicalNetworkId;
|
||||||
|
|
||||||
@Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID,
|
@Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, type=CommandType.UUID,
|
||||||
type=CommandType.LONG,
|
entityType = BigSwitchVnsDeviceResponse.class,
|
||||||
description="bigswitch vns device ID")
|
description="bigswitch vns device ID")
|
||||||
private Long bigswitchVnsDeviceId;
|
private Long bigswitchVnsDeviceId;
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,10 @@ public class BigSwitchVnsDeviceResponse extends BaseResponse {
|
|||||||
@SerializedName(ApiConstants.HOST_NAME) @Param(description="the controller Ip address")
|
@SerializedName(ApiConstants.HOST_NAME) @Param(description="the controller Ip address")
|
||||||
private String hostName;
|
private String hostName;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(String vnsDeviceId) {
|
public void setId(String vnsDeviceId) {
|
||||||
this.id = vnsDeviceId;
|
this.id = vnsDeviceId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,11 @@ import javax.persistence.GenerationType;
|
|||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="external_bigswitch_vns_devices")
|
@Table(name="external_bigswitch_vns_devices")
|
||||||
public class BigSwitchVnsDeviceVO {
|
public class BigSwitchVnsDeviceVO implements InternalIdentity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@ -16,7 +16,18 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.bigswitch;
|
package com.cloud.network.bigswitch;
|
||||||
|
|
||||||
public class Attachment {
|
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 id;
|
||||||
private String mac;
|
private String mac;
|
||||||
|
|
||||||
@ -35,4 +46,5 @@ public class Attachment {
|
|||||||
public void setMac(String mac) {
|
public void setMac(String mac) {
|
||||||
this.mac = mac;
|
this.mac = mac;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -49,10 +49,10 @@ public class BigSwitchVnsApi {
|
|||||||
private static final Logger s_logger = Logger.getLogger(BigSwitchVnsApi.class);
|
private static final Logger s_logger = Logger.getLogger(BigSwitchVnsApi.class);
|
||||||
private final static String _protocol = "http";
|
private final static String _protocol = "http";
|
||||||
private final static String _nsBaseUri = "/networkService/v1.1";
|
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 CONTENT_TYPE = "Content-Type";
|
||||||
|
private final static String ACCEPT = "Accept";
|
||||||
private final static String CONTENT_JSON = "application/json";
|
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 String CLOUDSTACK_INSTANCE_ID = "org.apache.cloudstack";
|
||||||
private final static MultiThreadedHttpConnectionManager s_httpClientManager =
|
private final static MultiThreadedHttpConnectionManager s_httpClientManager =
|
||||||
new MultiThreadedHttpConnectionManager();
|
new MultiThreadedHttpConnectionManager();
|
||||||
@ -114,55 +114,56 @@ public class BigSwitchVnsApi {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createNetwork(Network network)
|
public void createNetwork(NetworkData network)
|
||||||
throws BigSwitchVnsApiException {
|
throws BigSwitchVnsApiException {
|
||||||
String uri = _nsBaseUri + "/tenant/" + network.getTenant_id() + "/network";
|
String uri = _nsBaseUri + "/tenants/" + network.getNetwork().getTenant_id() + "/networks";
|
||||||
executeCreateObject(network, new TypeToken<Network>(){}.getType(),
|
executeCreateObject(network, new TypeToken<NetworkData>(){}.getType(),
|
||||||
uri, Collections.<String,String>emptyMap());
|
uri, Collections.<String,String>emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteNetwork(String tenantId, String networkId) throws BigSwitchVnsApiException {
|
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);
|
executeDeleteObject(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPort(String networkUuid, Port port)
|
public void createPort(String networkUuid, PortData port)
|
||||||
throws BigSwitchVnsApiException {
|
throws BigSwitchVnsApiException {
|
||||||
String uri = _nsBaseUri + "/tenant/" + port.getTenant_id() + "/networks/" + networkUuid + "/ports";
|
String uri = _nsBaseUri + "/tenants/" + port.getPort().getTenant_id() + "/networks/" + networkUuid + "/ports";
|
||||||
executeCreateObject(port, new TypeToken<Port>(){}.getType(),
|
executeCreateObject(port, new TypeToken<PortData>(){}.getType(),
|
||||||
uri, Collections.<String,String>emptyMap());
|
uri, Collections.<String,String>emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modifyPort(String networkId, Port port)
|
public void modifyPort(String networkId, PortData port)
|
||||||
throws BigSwitchVnsApiException {
|
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());
|
executeUpdateObject(port, uri, Collections.<String,String>emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deletePort(String tenantId, String networkId, String portId)
|
public void deletePort(String tenantId, String networkId, String portId)
|
||||||
throws BigSwitchVnsApiException {
|
throws BigSwitchVnsApiException {
|
||||||
String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId;
|
String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId;
|
||||||
executeDeleteObject(uri);
|
executeDeleteObject(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modifyPortAttachment(String tenantId,
|
public void modifyPortAttachment(String tenantId,
|
||||||
String networkId,
|
String networkId,
|
||||||
String portId,
|
String portId,
|
||||||
Attachment attachment) throws BigSwitchVnsApiException {
|
AttachmentData attachment) throws BigSwitchVnsApiException {
|
||||||
String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
|
String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
|
||||||
executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
|
executeUpdateObject(attachment, uri, Collections.<String,String>emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deletePortAttachment(String tenantId, String networkId, String portId)
|
public void deletePortAttachment(String tenantId, String networkId, String portId)
|
||||||
throws BigSwitchVnsApiException {
|
throws BigSwitchVnsApiException {
|
||||||
String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
|
String uri = _nsBaseUri + "/tenants/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment";
|
||||||
executeDeleteObject(uri);
|
executeDeleteObject(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlClusterStatus getControlClusterStatus() throws BigSwitchVnsApiException {
|
public ControlClusterStatus getControlClusterStatus() throws BigSwitchVnsApiException {
|
||||||
String uri = _controllerBaseUri + "/health/json";
|
String uri = _nsBaseUri + "/health";
|
||||||
ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>(){}.getType(),
|
ControlClusterStatus ccs = executeRetrieveObject(new TypeToken<ControlClusterStatus>(){}.getType(),
|
||||||
uri, 80, null);
|
uri, 80, null);
|
||||||
|
ccs.setStatus(true);
|
||||||
|
|
||||||
return ccs;
|
return ccs;
|
||||||
}
|
}
|
||||||
@ -177,6 +178,7 @@ public class BigSwitchVnsApi {
|
|||||||
|
|
||||||
PutMethod pm = (PutMethod) createMethod("put", uri, 80);
|
PutMethod pm = (PutMethod) createMethod("put", uri, 80);
|
||||||
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
||||||
|
pm.setRequestHeader(ACCEPT, CONTENT_JSON);
|
||||||
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
||||||
try {
|
try {
|
||||||
pm.setRequestEntity(new StringRequestEntity(
|
pm.setRequestEntity(new StringRequestEntity(
|
||||||
@ -207,6 +209,7 @@ public class BigSwitchVnsApi {
|
|||||||
|
|
||||||
PostMethod pm = (PostMethod) createMethod("post", uri, 80);
|
PostMethod pm = (PostMethod) createMethod("post", uri, 80);
|
||||||
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
||||||
|
pm.setRequestHeader(ACCEPT, CONTENT_JSON);
|
||||||
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
||||||
try {
|
try {
|
||||||
pm.setRequestEntity(new StringRequestEntity(
|
pm.setRequestEntity(new StringRequestEntity(
|
||||||
@ -235,6 +238,7 @@ public class BigSwitchVnsApi {
|
|||||||
|
|
||||||
DeleteMethod dm = (DeleteMethod) createMethod("delete", uri, 80);
|
DeleteMethod dm = (DeleteMethod) createMethod("delete", uri, 80);
|
||||||
dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
||||||
|
dm.setRequestHeader(ACCEPT, CONTENT_JSON);
|
||||||
dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
||||||
|
|
||||||
executeMethod(dm);
|
executeMethod(dm);
|
||||||
@ -257,6 +261,7 @@ public class BigSwitchVnsApi {
|
|||||||
|
|
||||||
GetMethod gm = (GetMethod) createMethod("get", uri, port);
|
GetMethod gm = (GetMethod) createMethod("get", uri, port);
|
||||||
gm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
gm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON);
|
||||||
|
gm.setRequestHeader(ACCEPT, CONTENT_JSON);
|
||||||
gm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
gm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID);
|
||||||
|
|
||||||
if (parameters != null && !parameters.isEmpty()) {
|
if (parameters != null && !parameters.isEmpty()) {
|
||||||
|
|||||||
@ -22,4 +22,8 @@ public class ControlClusterStatus {
|
|||||||
public boolean getStatus() {
|
public boolean getStatus() {
|
||||||
return healthy;
|
return healthy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatus(boolean status) {
|
||||||
|
this.healthy = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,7 +16,18 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.bigswitch;
|
package com.cloud.network.bigswitch;
|
||||||
|
|
||||||
public class Port {
|
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 id;
|
||||||
private String name;
|
private String name;
|
||||||
private String tenant_id;
|
private String tenant_id;
|
||||||
@ -53,4 +64,5 @@ public class Port {
|
|||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,6 @@ import com.cloud.network.dao.PhysicalNetworkVO;
|
|||||||
import com.cloud.network.resource.BigSwitchVnsResource;
|
import com.cloud.network.resource.BigSwitchVnsResource;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.resource.ResourceManager;
|
import com.cloud.resource.ResourceManager;
|
||||||
import com.cloud.resource.ResourceState;
|
|
||||||
import com.cloud.resource.ResourceStateAdapter;
|
import com.cloud.resource.ResourceStateAdapter;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.resource.UnableDeleteHostException;
|
import com.cloud.resource.UnableDeleteHostException;
|
||||||
@ -139,7 +138,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
|
|||||||
if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) {
|
if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (!_networkModel.isProviderForNetwork(getProvider(),
|
if (!_networkModel.isProviderForNetwork(getProvider(),
|
||||||
network.getId())) {
|
network.getId())) {
|
||||||
s_logger.debug("BigSwitchVnsElement is not a provider for network "
|
s_logger.debug("BigSwitchVnsElement is not a provider for network "
|
||||||
@ -154,7 +153,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
|
|||||||
+ network.getDisplayText());
|
+ network.getDisplayText());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +197,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
String mac = nic.getMacAddress();
|
String mac = nic.getMacAddress();
|
||||||
String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
|
String tenantId = context.getDomain().getName();
|
||||||
|
|
||||||
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
|
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
|
||||||
.listByPhysicalNetwork(network.getPhysicalNetworkId());
|
.listByPhysicalNetwork(network.getPhysicalNetworkId());
|
||||||
@ -242,7 +241,7 @@ public class BigSwitchVnsElement extends AdapterBase implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
|
String tenantId = context.getDomain().getName();
|
||||||
|
|
||||||
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
|
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao
|
||||||
.listByPhysicalNetwork(network.getPhysicalNetworkId());
|
.listByPhysicalNetwork(network.getPhysicalNetworkId());
|
||||||
@ -462,8 +461,9 @@ public class BigSwitchVnsElement extends AdapterBase implements
|
|||||||
HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
|
HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
|
||||||
Long hostId = bigswitchHost.getId();
|
Long hostId = bigswitchHost.getId();
|
||||||
|
|
||||||
bigswitchHost.setResourceState(ResourceState.Maintenance);
|
//bigswitchHost.setResourceState(ResourceState.Maintenance);
|
||||||
_hostDao.update(hostId, bigswitchHost);
|
//_hostDao.update(hostId, bigswitchHost);
|
||||||
|
_hostDao.remove(hostId);
|
||||||
_resourceMgr.deleteHost(hostId, false, false);
|
_resourceMgr.deleteHost(hostId, false, false);
|
||||||
|
|
||||||
_bigswitchVnsDao.remove(bigswitchVnsDeviceId);
|
_bigswitchVnsDao.remove(bigswitchVnsDeviceId);
|
||||||
|
|||||||
@ -179,7 +179,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
name = name.substring(0, 63); // max length 64
|
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);
|
List<BigSwitchVnsDeviceVO> devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId);
|
||||||
if (devices.isEmpty()) {
|
if (devices.isEmpty()) {
|
||||||
s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
|
s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId);
|
||||||
@ -244,7 +244,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
|
BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0);
|
||||||
HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
|
HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId());
|
||||||
|
|
||||||
String tenantId = profile.getNetworkDomain() + "-" + profile.getAccountId();
|
String tenantId = profile.getNetworkDomain();
|
||||||
|
|
||||||
DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId,
|
DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId,
|
||||||
networkObject.getBroadcastUri().getSchemeSpecificPart());
|
networkObject.getBroadcastUri().getSchemeSpecificPart());
|
||||||
|
|||||||
@ -47,9 +47,9 @@ import com.cloud.host.Host.Type;
|
|||||||
import com.cloud.network.bigswitch.BigSwitchVnsApi;
|
import com.cloud.network.bigswitch.BigSwitchVnsApi;
|
||||||
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
|
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
|
||||||
import com.cloud.network.bigswitch.ControlClusterStatus;
|
import com.cloud.network.bigswitch.ControlClusterStatus;
|
||||||
import com.cloud.network.bigswitch.Attachment;
|
import com.cloud.network.bigswitch.AttachmentData;
|
||||||
import com.cloud.network.bigswitch.Network;
|
import com.cloud.network.bigswitch.NetworkData;
|
||||||
import com.cloud.network.bigswitch.Port;
|
import com.cloud.network.bigswitch.PortData;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.utils.component.ManagerBase;
|
import com.cloud.utils.component.ManagerBase;
|
||||||
|
|
||||||
@ -193,15 +193,15 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) {
|
private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) {
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
network.setTenant_id(cmd.getTenantUuid());
|
network.getNetwork().setTenant_id(cmd.getTenantUuid());
|
||||||
network.setUuid(cmd.getNetworkUuid());
|
network.getNetwork().setUuid(cmd.getNetworkUuid());
|
||||||
network.setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
|
network.getNetwork().setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64));
|
||||||
network.setVlan(cmd.getVlan());
|
network.getNetwork().setVlan(cmd.getVlan());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_bigswitchVnsApi.createNetwork(network);
|
_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) {
|
} catch (BigSwitchVnsApiException e) {
|
||||||
if (numRetries > 0) {
|
if (numRetries > 0) {
|
||||||
return retry(cmd, --numRetries);
|
return retry(cmd, --numRetries);
|
||||||
@ -228,17 +228,17 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Answer executeRequest(CreateVnsPortCommand cmd, int numRetries) {
|
private Answer executeRequest(CreateVnsPortCommand cmd, int numRetries) {
|
||||||
Port port = new Port();
|
PortData port = new PortData();
|
||||||
port.setId(cmd.getPortUuid());
|
port.getPort().setId(cmd.getPortUuid());
|
||||||
port.setName(cmd.getPortName());
|
port.getPort().setName(cmd.getPortName());
|
||||||
port.setTenant_id(cmd.getTenantUuid());
|
port.getPort().setTenant_id(cmd.getTenantUuid());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_bigswitchVnsApi.createPort(cmd.getNetworkUuid(), port);
|
_bigswitchVnsApi.createPort(cmd.getNetworkUuid(), port);
|
||||||
try {
|
try {
|
||||||
Attachment attachment = new Attachment();
|
AttachmentData attachment = new AttachmentData();
|
||||||
attachment.setId(cmd.getPortUuid());
|
attachment.getAttachment().setId(cmd.getPortUuid());
|
||||||
attachment.setMac(cmd.getMac());
|
attachment.getAttachment().setMac(cmd.getMac());
|
||||||
_bigswitchVnsApi.modifyPortAttachment(cmd.getTenantUuid(),
|
_bigswitchVnsApi.modifyPortAttachment(cmd.getTenantUuid(),
|
||||||
cmd.getNetworkUuid(), cmd.getPortUuid(), attachment);
|
cmd.getNetworkUuid(), cmd.getPortUuid(), attachment);
|
||||||
|
|
||||||
@ -279,10 +279,10 @@ public class BigSwitchVnsResource extends ManagerBase implements ServerResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Answer executeRequest(UpdateVnsPortCommand cmd, int numRetries) {
|
private Answer executeRequest(UpdateVnsPortCommand cmd, int numRetries) {
|
||||||
Port port = new Port();
|
PortData port = new PortData();
|
||||||
port.setId(cmd.getPortUuid());
|
port.getPort().setId(cmd.getPortUuid());
|
||||||
port.setName(cmd.getPortName());
|
port.getPort().setName(cmd.getPortName());
|
||||||
port.setTenant_id(cmd.getTenantUuid());
|
port.getPort().setTenant_id(cmd.getTenantUuid());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_bigswitchVnsApi.modifyPort(cmd.getNetworkUuid(), port);
|
_bigswitchVnsApi.modifyPort(cmd.getNetworkUuid(), port);
|
||||||
|
|||||||
@ -98,10 +98,10 @@ public class BigSwitchApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testExecuteCreateObject() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteCreateObject() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
_method = mock(PostMethod.class);
|
_method = mock(PostMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
|
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();
|
verify(_method, times(1)).releaseConnection();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ public class BigSwitchApiTest {
|
|||||||
@Test (expected=BigSwitchVnsApiException.class)
|
@Test (expected=BigSwitchVnsApiException.class)
|
||||||
public void testExecuteCreateObjectFailure() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteCreateObjectFailure() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
_method = mock(PostMethod.class);
|
_method = mock(PostMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||||
Header header = mock(Header.class);
|
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.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||||
when(_method.isRequestSent()).thenReturn(true);
|
when(_method.isRequestSent()).thenReturn(true);
|
||||||
try {
|
try {
|
||||||
_api.executeCreateObject(network, Network.class, "/", Collections.<String, String> emptyMap());
|
_api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
|
||||||
} finally {
|
} finally {
|
||||||
verify(_method, times(1)).releaseConnection();
|
verify(_method, times(1)).releaseConnection();
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ public class BigSwitchApiTest {
|
|||||||
@Test (expected=BigSwitchVnsApiException.class)
|
@Test (expected=BigSwitchVnsApiException.class)
|
||||||
public void testExecuteCreateObjectException() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteCreateObjectException() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
|
when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException());
|
||||||
_method = mock(PostMethod.class);
|
_method = mock(PostMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
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.getResponseHeader("Content-Type")).thenReturn(header);
|
||||||
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later.");
|
||||||
try {
|
try {
|
||||||
_api.executeCreateObject(network, Network.class, "/", Collections.<String, String> emptyMap());
|
_api.executeCreateObject(network, NetworkData.class, "/", Collections.<String, String> emptyMap());
|
||||||
} finally {
|
} finally {
|
||||||
verify(_method, times(1)).releaseConnection();
|
verify(_method, times(1)).releaseConnection();
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class BigSwitchApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testExecuteUpdateObject() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteUpdateObject() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
_method = mock(PutMethod.class);
|
_method = mock(PutMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
|
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
|
||||||
_api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
|
_api.executeUpdateObject(network, "/", Collections.<String, String> emptyMap());
|
||||||
@ -156,7 +156,7 @@ public class BigSwitchApiTest {
|
|||||||
@Test (expected=BigSwitchVnsApiException.class)
|
@Test (expected=BigSwitchVnsApiException.class)
|
||||||
public void testExecuteUpdateObjectFailure() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteUpdateObjectFailure() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
_method = mock(PutMethod.class);
|
_method = mock(PutMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||||
Header header = mock(Header.class);
|
Header header = mock(Header.class);
|
||||||
@ -174,7 +174,7 @@ public class BigSwitchApiTest {
|
|||||||
@Test (expected=BigSwitchVnsApiException.class)
|
@Test (expected=BigSwitchVnsApiException.class)
|
||||||
public void testExecuteUpdateObjectException() throws BigSwitchVnsApiException, IOException {
|
public void testExecuteUpdateObjectException() throws BigSwitchVnsApiException, IOException {
|
||||||
_api.setControllerAddress("10.10.0.10");
|
_api.setControllerAddress("10.10.0.10");
|
||||||
Network network = new Network();
|
NetworkData network = new NetworkData();
|
||||||
_method = mock(PutMethod.class);
|
_method = mock(PutMethod.class);
|
||||||
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
|
when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK);
|
||||||
when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
|
when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException());
|
||||||
|
|||||||
@ -41,10 +41,10 @@ import com.cloud.agent.api.StartupCommand;
|
|||||||
import com.cloud.agent.api.UpdateVnsPortAnswer;
|
import com.cloud.agent.api.UpdateVnsPortAnswer;
|
||||||
import com.cloud.agent.api.UpdateVnsPortCommand;
|
import com.cloud.agent.api.UpdateVnsPortCommand;
|
||||||
import com.cloud.host.Host;
|
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.ControlClusterStatus;
|
||||||
import com.cloud.network.bigswitch.Network;
|
import com.cloud.network.bigswitch.NetworkData;
|
||||||
import com.cloud.network.bigswitch.Port;
|
import com.cloud.network.bigswitch.PortData;
|
||||||
import com.cloud.network.bigswitch.BigSwitchVnsApi;
|
import com.cloud.network.bigswitch.BigSwitchVnsApi;
|
||||||
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
|
import com.cloud.network.bigswitch.BigSwitchVnsApiException;
|
||||||
|
|
||||||
@ -140,7 +140,9 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testRetries() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testRetries() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_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");
|
when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
|
||||||
|
|
||||||
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
|
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
|
||||||
@ -152,7 +154,9 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_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");
|
when(network.getUuid()).thenReturn("cccc").thenReturn("cccc");
|
||||||
|
|
||||||
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
|
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
|
||||||
@ -164,9 +168,11 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_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");
|
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);
|
CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1);
|
||||||
CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
|
CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc);
|
||||||
@ -197,8 +203,10 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testCreatePort() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testCreatePort() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_resource.configure("BigSwitchVnsResource", _parameters);
|
||||||
|
|
||||||
Port networkp = mock(Port.class);
|
PortData portdata = mock(PortData.class);
|
||||||
when(networkp.getId()).thenReturn("eeee");
|
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");
|
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
|
||||||
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
||||||
@ -209,9 +217,11 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testCreatePortApiExceptionInCreate() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testCreatePortApiExceptionInCreate() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_resource.configure("BigSwitchVnsResource", _parameters);
|
||||||
|
|
||||||
Port networkp = mock(Port.class);
|
PortData portdata = mock(PortData.class);
|
||||||
when(networkp.getId()).thenReturn("eeee");
|
PortData.Port port = mock(PortData.Port.class);
|
||||||
doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (Port)any());
|
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");
|
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
|
||||||
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
||||||
@ -222,9 +232,11 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testCreatePortApiExceptionInModify() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testCreatePortApiExceptionInModify() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_resource.configure("BigSwitchVnsResource", _parameters);
|
||||||
|
|
||||||
Port networkp = mock(Port.class);
|
PortData portdata = mock(PortData.class);
|
||||||
when(networkp.getId()).thenReturn("eeee");
|
PortData.Port port = mock(PortData.Port.class);
|
||||||
doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (Attachment)any());
|
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");
|
CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff");
|
||||||
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc);
|
||||||
@ -246,7 +258,7 @@ public class BigSwitchVnsResourceTest {
|
|||||||
public void testUpdatePortException() throws ConfigurationException, BigSwitchVnsApiException {
|
public void testUpdatePortException() throws ConfigurationException, BigSwitchVnsApiException {
|
||||||
_resource.configure("BigSwitchVnsResource", _parameters);
|
_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(
|
UpdateVnsPortAnswer dntkpa = (UpdateVnsPortAnswer) _resource.executeRequest(
|
||||||
new UpdateVnsPortCommand("networkId","portId","tenantId","portname"));
|
new UpdateVnsPortCommand("networkId","portId","tenantId","portname"));
|
||||||
assertFalse(dntkpa.getResult());
|
assertFalse(dntkpa.getResult());
|
||||||
|
|||||||
@ -1470,6 +1470,9 @@ dictionary = {
|
|||||||
'label.action.vmsnapshot.delete': '<fmt:message key="label.action.vmsnapshot.delete" />',
|
'label.action.vmsnapshot.delete': '<fmt:message key="label.action.vmsnapshot.delete" />',
|
||||||
'label.action.vmsnapshot.revert': '<fmt:message key="label.action.vmsnapshot.revert" />',
|
'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.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>
|
</script>
|
||||||
|
|||||||
@ -4109,6 +4109,199 @@
|
|||||||
notification: { poll: pollAsyncJobResult }
|
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: {
|
pods: {
|
||||||
title: 'label.pods',
|
title: 'label.pods',
|
||||||
listView: {
|
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) {
|
var afterCreateZonePhysicalNetworkTrafficTypes = function(args, newZoneObj, newPhysicalnetwork) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -10981,6 +11344,9 @@
|
|||||||
break;
|
break;
|
||||||
case "NiciraNvp":
|
case "NiciraNvp":
|
||||||
nspMap["niciraNvp"] = items[i];
|
nspMap["niciraNvp"] = items[i];
|
||||||
|
break;
|
||||||
|
case "BigSwitchVns":
|
||||||
|
nspMap["bigswitchVns"] = items[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11003,6 +11369,11 @@
|
|||||||
id: 'niciraNvp',
|
id: 'niciraNvp',
|
||||||
name: 'Nicira Nvp',
|
name: 'Nicira Nvp',
|
||||||
state: nspMap.niciraNvp ? nspMap.niciraNvp.state : 'Disabled'
|
state: nspMap.niciraNvp ? nspMap.niciraNvp.state : 'Disabled'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'bigswitchVns',
|
||||||
|
name: 'BigSwitch Vns',
|
||||||
|
state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state : 'Disabled'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user