mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	cloudStack 3.0 new UI - NaaS - implement add F5 load balancer device from listView.
This commit is contained in:
		
							parent
							
								
									5ea4133d7b
								
							
						
					
					
						commit
						aae3f4a13f
					
				@ -1077,7 +1077,8 @@
 | 
			
		||||
                      label: 'Private interface'
 | 
			
		||||
                    },
 | 
			
		||||
                    numretries: {
 | 
			
		||||
                      label: 'Number of retries'
 | 
			
		||||
                      label: 'Number of retries',
 | 
			
		||||
                      defaultValue: '2'
 | 
			
		||||
                    },
 | 
			
		||||
                    inline: {
 | 
			
		||||
                      label: 'Mode',
 | 
			
		||||
@ -1133,13 +1134,14 @@
 | 
			
		||||
                                $("body").stopTime(timerKey);
 | 
			
		||||
                                if (result.jobstatus == 1) {                                                              
 | 
			
		||||
                                  //alert("addNetworkServiceProvider&name=F5BigIp succeeded.");  
 | 
			
		||||
 | 
			
		||||
                                  //addF5LoadBalancer starts here                                
 | 
			
		||||
                                  var array1 = [];
 | 
			
		||||
                                  array1.push("&physicalnetworkid=" + physicalNetworkObj.id);                                 
 | 
			
		||||
                                  array1.push("&username=" + todb(args.data.username));
 | 
			
		||||
                                  array1.push("&password=" + todb(args.data.password));
 | 
			
		||||
                                  array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype));
 | 
			
		||||
                                                                                                     
 | 
			
		||||
                                  //???                                  
 | 
			
		||||
                                  //*** construct URL (begin)	***	
 | 
			
		||||
                                  var url = [];
 | 
			
		||||
                                  
 | 
			
		||||
@ -1240,6 +1242,8 @@
 | 
			
		||||
                                      );           
 | 
			
		||||
                                    }
 | 
			
		||||
                                  });    
 | 
			
		||||
                                  //addF5LoadBalancer ends here
 | 
			
		||||
                                  
 | 
			
		||||
                                } 
 | 
			
		||||
                                else if (result.jobstatus == 2) {
 | 
			
		||||
                                  alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + fromdb(result.jobresult.errortext));					        							        								   				    
 | 
			
		||||
@ -1256,12 +1260,96 @@
 | 
			
		||||
                    });                    
 | 
			
		||||
                  }
 | 
			
		||||
                  else { //naasStatusMap["f5"] == "enabled"                    
 | 
			
		||||
                    //addF5LoadBalancer starts here                                
 | 
			
		||||
                    var array1 = [];
 | 
			
		||||
                    array1.push("&physicalnetworkid=" + physicalNetworkObj.id)
 | 
			
		||||
                    array1.push("&url=" + todb(args.data.url));
 | 
			
		||||
                    array1.push("&physicalnetworkid=" + physicalNetworkObj.id);                                 
 | 
			
		||||
                    array1.push("&username=" + todb(args.data.username));
 | 
			
		||||
                    array1.push("&password=" + todb(args.data.password));
 | 
			
		||||
                    array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype));
 | 
			
		||||
                                                                                       
 | 
			
		||||
                    //*** construct URL (begin)	***	
 | 
			
		||||
                    var url = [];
 | 
			
		||||
                    
 | 
			
		||||
                    var ip = args.data.ip;
 | 
			
		||||
                    url.push("https://" + ip);	 
 | 
			
		||||
                    
 | 
			
		||||
                    var isQuestionMarkAdded = false;
 | 
			
		||||
                    
 | 
			
		||||
                    var publicInterface = args.data.publicinterface;
 | 
			
		||||
                    if(publicInterface != null && publicInterface.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  				    
 | 
			
		||||
                        url.push("publicinterface=" + publicInterface); 
 | 
			
		||||
                    }
 | 
			
		||||
                        
 | 
			
		||||
                    var privateInterface = args.data.privateinterface;
 | 
			
		||||
                    if(privateInterface != null && privateInterface.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  		
 | 
			
		||||
                        url.push("privateinterface=" + privateInterface); 
 | 
			
		||||
                    }
 | 
			
		||||
                    
 | 
			
		||||
                    var numretries = args.data.numretries;
 | 
			
		||||
                    if(numretries != null && numretries.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  		
 | 
			
		||||
                        url.push("numretries=" + numretries); 	
 | 
			
		||||
                    }		
 | 
			
		||||
                    
 | 
			
		||||
                    var isInline = args.data.inline;				
 | 
			
		||||
                    if(isInline != null && isInline.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  		
 | 
			
		||||
                        url.push("inline=" + isInline); 
 | 
			
		||||
                    }
 | 
			
		||||
                   
 | 
			
		||||
                    var capacity = args.data.capacity;				
 | 
			
		||||
                    if(capacity != null && capacity.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  		
 | 
			
		||||
                        url.push("capacity=" + capacity); 
 | 
			
		||||
                    }
 | 
			
		||||
                   
 | 
			
		||||
                    var dedicated = (args.data.dedicated == "on");				
 | 
			
		||||
                    if(dedicated != null && dedicated.length > 0) {
 | 
			
		||||
                        if(isQuestionMarkAdded == false) {
 | 
			
		||||
                            url.push("?");
 | 
			
		||||
                            isQuestionMarkAdded = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            url.push("&");
 | 
			
		||||
                        }  
 | 
			
		||||
                        url.push("dedicated=" + dedicated.toString()); 
 | 
			
		||||
                    }
 | 
			
		||||
                         
 | 
			
		||||
                    array1.push("&url=" + todb(url.join("")));	                                                                   
 | 
			
		||||
                    //*** construct URL (end)	***		
 | 
			
		||||
                                                      
 | 
			
		||||
                    $.ajax({
 | 
			
		||||
                      url: createURL("addF5LoadBalancer" + array1.join("")),
 | 
			
		||||
                      dataType: "json",
 | 
			
		||||
@ -1279,6 +1367,8 @@
 | 
			
		||||
                        );           
 | 
			
		||||
                      }
 | 
			
		||||
                    });    
 | 
			
		||||
                    //addF5LoadBalancer ends here                    
 | 
			
		||||
                    
 | 
			
		||||
                  }                       
 | 
			
		||||
                },
 | 
			
		||||
                messages: {
 | 
			
		||||
@ -1329,9 +1419,10 @@
 | 
			
		||||
                label: 'Add new SRX',
 | 
			
		||||
                createForm: {
 | 
			
		||||
                  title: 'Add new SRX',     
 | 
			
		||||
                  //???
 | 
			
		||||
                  fields: {
 | 
			
		||||
                    url: {
 | 
			
		||||
                      label: 'URL'
 | 
			
		||||
                    ip: {
 | 
			
		||||
                      label: 'IP address'
 | 
			
		||||
                    },
 | 
			
		||||
                    username: {
 | 
			
		||||
                      label: 'Username'
 | 
			
		||||
@ -1347,6 +1438,34 @@
 | 
			
		||||
                        items.push({id: "JuniperSRXFirewall", description: "Juniper SRX Firewall"});                        
 | 
			
		||||
                        args.response.success({data: items});
 | 
			
		||||
                      }
 | 
			
		||||
                    },          
 | 
			
		||||
                    publicinterface: {
 | 
			
		||||
                      label: 'Public interface'
 | 
			
		||||
                    },
 | 
			
		||||
                    privateinterface: {
 | 
			
		||||
                      label: 'Private interface'
 | 
			
		||||
                    },
 | 
			
		||||
                    numretries: {
 | 
			
		||||
                      label: 'Number of retries',
 | 
			
		||||
                      defaultValue: '2'
 | 
			
		||||
                    },
 | 
			
		||||
                    inline: {
 | 
			
		||||
                      label: 'Mode',
 | 
			
		||||
                      select: function(args) {
 | 
			
		||||
                        var items = [];
 | 
			
		||||
                        items.push({id: "false", description: "side by side"});  
 | 
			
		||||
                        items.push({id: "true", description: "inline"});  
 | 
			
		||||
                        args.response.success({data: items});
 | 
			
		||||
                      }                      
 | 
			
		||||
                    },
 | 
			
		||||
                    capacity: {
 | 
			
		||||
                      label: 'Capacity',                      
 | 
			
		||||
                      validation: { required: false, number: true }                      
 | 
			
		||||
                    },
 | 
			
		||||
                    dedicated: {
 | 
			
		||||
                      label: 'Dedicated',
 | 
			
		||||
                      isBoolean: true,
 | 
			
		||||
                      isChecked: false
 | 
			
		||||
                    }   
 | 
			
		||||
                  }                  
 | 
			
		||||
                },
 | 
			
		||||
@ -1384,12 +1503,98 @@
 | 
			
		||||
                                $("body").stopTime(timerKey);
 | 
			
		||||
                                if (result.jobstatus == 1) {                                                              
 | 
			
		||||
                                  //alert("addNetworkServiceProvider&name=JuniperSRX succeeded.");                                    
 | 
			
		||||
                                 
 | 
			
		||||
                                  //???
 | 
			
		||||
                                  //addSrxFirewall starts here                                
 | 
			
		||||
                                  var array1 = [];
 | 
			
		||||
                                  array1.push("&physicalnetworkid=" + physicalNetworkObj.id)
 | 
			
		||||
                                  array1.push("&url=" + todb(args.data.url));
 | 
			
		||||
                                  array1.push("&physicalnetworkid=" + physicalNetworkObj.id);                                 
 | 
			
		||||
                                  array1.push("&username=" + todb(args.data.username));
 | 
			
		||||
                                  array1.push("&password=" + todb(args.data.password));
 | 
			
		||||
                                  array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype));
 | 
			
		||||
                                                                                                     
 | 
			
		||||
                                  //*** construct URL (begin)	***	
 | 
			
		||||
                                  var url = [];
 | 
			
		||||
                                  
 | 
			
		||||
                                  var ip = args.data.ip;
 | 
			
		||||
                                  url.push("https://" + ip);	 
 | 
			
		||||
                                  
 | 
			
		||||
                                  var isQuestionMarkAdded = false;
 | 
			
		||||
                                  
 | 
			
		||||
                                  var publicInterface = args.data.publicinterface;
 | 
			
		||||
                                  if(publicInterface != null && publicInterface.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  				    
 | 
			
		||||
                                      url.push("publicinterface=" + publicInterface); 
 | 
			
		||||
                                  }
 | 
			
		||||
                                      
 | 
			
		||||
                                  var privateInterface = args.data.privateinterface;
 | 
			
		||||
                                  if(privateInterface != null && privateInterface.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  		
 | 
			
		||||
                                      url.push("privateinterface=" + privateInterface); 
 | 
			
		||||
                                  }
 | 
			
		||||
                                  
 | 
			
		||||
                                  var numretries = args.data.numretries;
 | 
			
		||||
                                  if(numretries != null && numretries.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  		
 | 
			
		||||
                                      url.push("numretries=" + numretries); 	
 | 
			
		||||
                                  }		
 | 
			
		||||
                                  
 | 
			
		||||
                                  var isInline = args.data.inline;				
 | 
			
		||||
                                  if(isInline != null && isInline.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  		
 | 
			
		||||
                                      url.push("inline=" + isInline); 
 | 
			
		||||
                                  }
 | 
			
		||||
                                 
 | 
			
		||||
                                  var capacity = args.data.capacity;				
 | 
			
		||||
                                  if(capacity != null && capacity.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  		
 | 
			
		||||
                                      url.push("capacity=" + capacity); 
 | 
			
		||||
                                  }
 | 
			
		||||
                                 
 | 
			
		||||
                                  var dedicated = (args.data.dedicated == "on");				
 | 
			
		||||
                                  if(dedicated != null && dedicated.length > 0) {
 | 
			
		||||
                                      if(isQuestionMarkAdded == false) {
 | 
			
		||||
                                          url.push("?");
 | 
			
		||||
                                          isQuestionMarkAdded = true;
 | 
			
		||||
                                      }
 | 
			
		||||
                                      else {
 | 
			
		||||
                                          url.push("&");
 | 
			
		||||
                                      }  
 | 
			
		||||
                                      url.push("dedicated=" + dedicated.toString()); 
 | 
			
		||||
                                  }
 | 
			
		||||
                                       
 | 
			
		||||
                                  array1.push("&url=" + todb(url.join("")));	                                                                   
 | 
			
		||||
                                  //*** construct URL (end)	***		
 | 
			
		||||
                                                                    
 | 
			
		||||
                                  $.ajax({
 | 
			
		||||
                                    url: createURL("addSrxFirewall" + array1.join("")),
 | 
			
		||||
                                    dataType: "json",
 | 
			
		||||
@ -1407,6 +1612,8 @@
 | 
			
		||||
                                      );           
 | 
			
		||||
                                    }
 | 
			
		||||
                                  });    
 | 
			
		||||
                                  //addSrxFirewall ends here
 | 
			
		||||
                                  //???                                  
 | 
			
		||||
                                } 
 | 
			
		||||
                                else if (result.jobstatus == 2) {
 | 
			
		||||
                                  alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + fromdb(result.jobresult.errortext));					        							        								   				    
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user