diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 3ff35b43cf6..e8ee8618edb 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -2003,14 +2003,40 @@ $icmpFields.parent().find('label.error').hide(); } }); - - args.response.success({ - data: [ - { name: 'tcp', description: 'TCP' }, - { name: 'udp', description: 'UDP' }, - { name: 'icmp', description: 'ICMP' } - ] - }); + + var data = [ + { name: 'tcp', description: 'TCP' }, + { name: 'udp', description: 'UDP' } + ]; + //ICMP portocol is not supported in Firewall provided by JuniperSRX + $.ajax({ + url: createURL('listNetworkOfferings'), + data: { + id: args.context.networks[0].networkofferingid + }, + async: false, + success: function(json) { + var serviceArray = json.listnetworkofferingsresponse.networkoffering[0].service; + var FirewallProviderArrayIncludesJuniperSRX = false; + for(var i = 0; i < serviceArray.length; i++) { + if(serviceArray[i].name == "Firewall") { + var providerArray = serviceArray[i].provider; + for(var k = 0; k < providerArray.length; k++) { + if(providerArray[k].name == "JuniperSRX") { + FirewallProviderArrayIncludesJuniperSRX = true; + break; + } + } + break; + } + } + if(FirewallProviderArrayIncludesJuniperSRX == false) { + data.push({ name: 'icmp', description: 'ICMP' }); //show ICMP option only when provider is not JuniperSRX + } + } + }); + + args.response.success({data: data}); } }, 'startport': { edit: true, label: 'label.start.port' },