mirror of https://github.com/apache/cloudstack.git
Merge branch 'ui-cisco-asa1000v-support'
This commit is contained in:
commit
35164fde65
|
|
@ -0,0 +1,75 @@
|
|||
// 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.
|
||||
(function($, cloudStack) {
|
||||
cloudStack.modules.infrastructure = function(module) {
|
||||
module.pluginAPI.extend({
|
||||
networkServiceProvider: function(args) {
|
||||
var name = args.name;
|
||||
var id = args.id;
|
||||
var state = args.state;
|
||||
var detailView = args.detailView;
|
||||
var listView = args.listView;
|
||||
|
||||
cloudStack.sections.system.naas.networkProviders.types[id] = detailView;
|
||||
cloudStack.sections.system.subsections[listView.id] = {
|
||||
id: listView.id,
|
||||
title: name,
|
||||
listView: listView
|
||||
};
|
||||
|
||||
$(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) {
|
||||
var nspHardcodingArray = data.nspHardcodingArray;
|
||||
var selectedZoneObj = data.selectedZoneObj;
|
||||
var selectedPhysicalNetworkObj = data.selectedPhysicalNetworkObj;
|
||||
if(selectedZoneObj.networktype == "Advanced"){
|
||||
var selectedProviderObj = null;
|
||||
$.ajax({
|
||||
url: createURL('listNetworkServiceProviders'),
|
||||
data: {
|
||||
name: id, //e.g. 'CiscoVnmc'
|
||||
physicalnetworkid: selectedPhysicalNetworkObj.id
|
||||
},
|
||||
async: false,
|
||||
success: function(json){
|
||||
var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
|
||||
if(items != null && items.length > 0) {
|
||||
selectedProviderObj = items[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
nspHardcodingArray.push({
|
||||
id: id,
|
||||
name: name,
|
||||
state: selectedProviderObj? selectedProviderObj.state : 'Disabled'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
resource: function(args) {
|
||||
var type = args.type;
|
||||
|
||||
if (type) {
|
||||
return cloudStack.sections.system.subsections[type];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}(jQuery, cloudStack));
|
||||
|
|
@ -16,5 +16,8 @@
|
|||
// under the License.
|
||||
(function($, cloudStack) {
|
||||
cloudStack.modules = [
|
||||
'infrastructure',
|
||||
'vnmcNetworkProvider',
|
||||
'vnmcAsa1000v'
|
||||
];
|
||||
}(jQuery, cloudStack));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,183 @@
|
|||
// 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.
|
||||
(function($, cloudStack) {
|
||||
cloudStack.modules.vnmcAsa1000v = function(module) {
|
||||
module.vnmcNetworkProvider.addDevice({
|
||||
id: 'asa1000v',
|
||||
title: 'ASA 1000v',
|
||||
listView: {
|
||||
id: 'asa1000vDevices',
|
||||
fields: {
|
||||
hostname: { label: 'label.host' },
|
||||
insideportprofile: { label: 'Inside Port Profile' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listCiscoAsa1000vResources'),
|
||||
data: {
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id
|
||||
},
|
||||
success: function(json){
|
||||
var items = json.listCiscoAsa1000vResources.CiscoAsa1000vResource;
|
||||
args.response.success({ data: items });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
label: 'Add CiscoASA1000v Resource',
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'Add CiscoASA1000v Resource';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'Add CiscoASA1000v Resource',
|
||||
fields: {
|
||||
hostname: {
|
||||
label: 'label.host',
|
||||
validation: { required: true }
|
||||
},
|
||||
insideportprofile: {
|
||||
label: 'Inside Port Profile',
|
||||
validation: { required: true }
|
||||
},
|
||||
clusterid: {
|
||||
label: 'label.cluster',
|
||||
validation: { required: true },
|
||||
select: function(args){
|
||||
$.ajax({
|
||||
url: createURL('listClusters'),
|
||||
data: {
|
||||
zoneid: args.context.zones[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var objs = json.listclustersresponse.cluster;
|
||||
var items = [];
|
||||
if(objs != null) {
|
||||
for(var i = 0; i < objs.length; i++){
|
||||
items.push({id: objs[i].id, description: objs[i].name});
|
||||
}
|
||||
}
|
||||
args.response.success({data: items});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
var data = {
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id,
|
||||
hostname: args.data.hostname,
|
||||
insideportprofile: args.data.insideportprofile,
|
||||
clusterid: args.data.clusterid
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: createURL('addCiscoAsa1000vResource'),
|
||||
data: data,
|
||||
success: function(json){
|
||||
var item = json.addCiscoAsa1000vResource.CiscoAsa1000vResource;
|
||||
args.response.success({data: item});
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
notification: {
|
||||
poll: function(args) {
|
||||
args.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'CiscoASA1000v details',
|
||||
actions: {
|
||||
remove: {
|
||||
label: 'delete CiscoASA1000v',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm you want to delete CiscoASA1000v';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'delete CiscoASA1000v';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('deleteCiscoAsa1000vResource'),
|
||||
data: {
|
||||
resourceid: args.context.asa1000vDevices[0].resourceid
|
||||
},
|
||||
success: function(json) {
|
||||
args.response.success();
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: function(args) {
|
||||
args.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
|
||||
fields: [
|
||||
{
|
||||
hostname: {
|
||||
label: 'label.host'
|
||||
}
|
||||
},
|
||||
{
|
||||
insideportprofile: { label: 'Inside Port Profile' },
|
||||
RESOURCE_NAME: { label: 'Resource Name' },
|
||||
resourceid: { label: 'Resource ID' }
|
||||
}
|
||||
],
|
||||
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listCiscoAsa1000vResources'),
|
||||
data: {
|
||||
resourceid: args.context.asa1000vDevices[0].resourceid
|
||||
},
|
||||
success: function(json) {
|
||||
var item = json.listCiscoAsa1000vResources.CiscoAsa1000vResource[0];
|
||||
args.response.success({ data: item });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}(jQuery, cloudStack));
|
||||
|
|
@ -0,0 +1,333 @@
|
|||
// 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.
|
||||
(function($, cloudStack) {
|
||||
cloudStack.modules.vnmcNetworkProvider = function(module) {
|
||||
var vnmcDeviceViewAll = window._m = [
|
||||
{
|
||||
label: 'VNMC Devices',
|
||||
path: '_zone.vnmcDevices'
|
||||
}
|
||||
];
|
||||
|
||||
var vnmcListView = {
|
||||
id: 'vnmcDevices',
|
||||
fields: {
|
||||
resourcename: { label: 'Resource Name' },
|
||||
provider: { label: 'Provider' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listCiscoVnmcResources'),
|
||||
data: {
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id
|
||||
},
|
||||
success: function(json){
|
||||
var items = json.listCiscoVnmcResources.CiscoVnmcResource;
|
||||
args.response.success({
|
||||
data: items
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
actions: {
|
||||
add: {
|
||||
label: 'Add VNMC device',
|
||||
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'Add VNMC device';
|
||||
}
|
||||
},
|
||||
|
||||
createForm: {
|
||||
title: 'Add VNMC device',
|
||||
fields: {
|
||||
hostname: {
|
||||
label: 'label.host',
|
||||
validation: { required: true }
|
||||
},
|
||||
username: {
|
||||
label: 'label.username',
|
||||
validation: { required: true }
|
||||
},
|
||||
password: {
|
||||
label: 'label.password',
|
||||
isPassword: true,
|
||||
validation: { required: true }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listNetworkServiceProviders'),
|
||||
data: {
|
||||
name: 'CiscoVnmc',
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id
|
||||
},
|
||||
success: function(json){
|
||||
var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
|
||||
if(items != null && items.length > 0) {
|
||||
var ciscoVnmcProvider = items[0];
|
||||
if(ciscoVnmcProvider.state == 'Enabled') {
|
||||
addCiscoVnmcResourceFn();
|
||||
}
|
||||
else {
|
||||
enableCiscoVnmcProviderFn(ciscoVnmcProvider);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$.ajax({
|
||||
url: createURL("addNetworkServiceProvider"),
|
||||
data: {
|
||||
name: 'CiscoVnmc',
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var jobId = json.addnetworkserviceproviderresponse.jobid;
|
||||
var addVnmcProviderIntervalID = 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(addVnmcProviderIntervalID );
|
||||
if (result.jobstatus == 1) {
|
||||
//nspMap["CiscoVnmc"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
|
||||
var ciscoVnmcProvider = json.queryasyncjobresultresponse.jobresult.networkserviceprovider;
|
||||
enableCiscoVnmcProviderFn(ciscoVnmcProvider);
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
args.response.error(_s(result.jobresult.errortext));
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
}, g_queryAsyncJobResultInterval);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var enableCiscoVnmcProviderFn = function(ciscoVnmcProvider){
|
||||
$.ajax({
|
||||
url: createURL('updateNetworkServiceProvider'),
|
||||
data: {
|
||||
id: ciscoVnmcProvider.id,
|
||||
state: 'Enabled'
|
||||
},
|
||||
success: function(json) {
|
||||
var jid = json.updatenetworkserviceproviderresponse.jobid;
|
||||
var enableVnmcProviderIntervalID = setInterval(function(){
|
||||
$.ajax({
|
||||
url: createURL('queryAsyncJobResult'),
|
||||
data: {
|
||||
jobid: jid
|
||||
},
|
||||
success: function(json){
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
clearInterval(enableVnmcProviderIntervalID);
|
||||
if (result.jobstatus == 1) {
|
||||
addCiscoVnmcResourceFn();
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
args.response.error(_s(result.jobresult.errortext));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, g_queryAsyncJobResultInterval);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var addCiscoVnmcResourceFn = function(){
|
||||
var data = {
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id,
|
||||
hostname: args.data.hostname,
|
||||
username: args.data.username,
|
||||
password: args.data.password
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: createURL('addCiscoVnmcResource'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var item = json.addCiscoVnmcResource.CiscoVnmcResource;
|
||||
args.response.success({data: item});
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
notification: {
|
||||
poll: function(args) {
|
||||
args.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'CiscoVNMC resource details',
|
||||
actions: {
|
||||
remove: {
|
||||
label: 'delete CiscoVNMC resource',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm you want to delete CiscoVNMC resource';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'delete CiscoVNMC resource';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('deleteCiscoVnmcResource'),
|
||||
data: {
|
||||
resourceid: args.context.vnmcDevices[0].resourceid
|
||||
},
|
||||
success: function(json) {
|
||||
args.response.success();
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: function(args) {
|
||||
args.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
resourcename: { label: 'Resource Name' }
|
||||
},
|
||||
{
|
||||
resourceid: { label: 'Resource ID'},
|
||||
provider: { label: 'Provider' },
|
||||
RESOURCE_NAME: { label: 'Resource Name'}
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listCiscoVnmcResources'),
|
||||
data: {
|
||||
resourceid: args.context.vnmcDevices[0].resourceid
|
||||
},
|
||||
success: function(json){
|
||||
var item = json.listCiscoVnmcResources.CiscoVnmcResource[0];
|
||||
args.response.success({ data: item });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var vnmcProviderDetailView = {
|
||||
id: 'vnmcProvider',
|
||||
label: 'VNMC',
|
||||
viewAll: vnmcDeviceViewAll,
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
name: { label: 'label.name' }
|
||||
},
|
||||
{
|
||||
state: { label: 'label.state' },
|
||||
id: { label: 'label.id' },
|
||||
servicelist: {
|
||||
label: 'Services',
|
||||
converter: function(args){
|
||||
if(args)
|
||||
return args.join(', ');
|
||||
else
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listNetworkServiceProviders'),
|
||||
data: {
|
||||
name: 'CiscoVnmc',
|
||||
physicalnetworkid: args.context.physicalNetworks[0].id
|
||||
},
|
||||
success: function(json){
|
||||
var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
|
||||
if(items != null && items.length > 0) {
|
||||
args.response.success({ data: items[0] });
|
||||
}
|
||||
else {
|
||||
args.response.success({
|
||||
data: {
|
||||
name: 'CiscoVnmc',
|
||||
state: 'Disabled'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.pluginAPI.extend({
|
||||
addDevice: function(device) {
|
||||
cloudStack.sections.system.subsections[device.id] = device;
|
||||
vnmcDeviceViewAll.push({ label: device.title, path: '_zone.' + device.id });
|
||||
}
|
||||
});
|
||||
|
||||
module.infrastructure.networkServiceProvider({
|
||||
id: 'CiscoVnmc',
|
||||
name: 'Cisco VNMC',
|
||||
//state: 'Disabled', //don't know state until log in and visit Infrastructure menu > zone detail > physical network > network service providers
|
||||
listView: vnmcListView,
|
||||
|
||||
detailView: vnmcProviderDetailView
|
||||
});
|
||||
};
|
||||
}(jQuery, cloudStack));
|
||||
|
|
@ -7980,6 +7980,7 @@
|
|||
|
||||
action: function(args) {
|
||||
var array1 = [];
|
||||
var appendData = args.data.append ? args.data.append : {};
|
||||
|
||||
array1.push("&zoneId=" + args.data.zoneid);
|
||||
array1.push("&name=" + todb(args.data.podname));
|
||||
|
|
@ -7993,6 +7994,7 @@
|
|||
|
||||
$.ajax({
|
||||
url: createURL("createPod" + array1.join("")),
|
||||
data: appendData,
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var item = json.createpodresponse.pod;
|
||||
|
|
@ -12141,6 +12143,12 @@
|
|||
}
|
||||
];
|
||||
|
||||
$(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', {
|
||||
nspHardcodingArray: nspHardcodingArray,
|
||||
selectedZoneObj: selectedZoneObj,
|
||||
selectedPhysicalNetworkObj: selectedPhysicalNetworkObj
|
||||
});
|
||||
|
||||
if(selectedZoneObj.networktype == "Basic") {
|
||||
nspHardcodingArray.push(
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue