diff --git a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java index a9c13afceea..4356c97d754 100644 --- a/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java +++ b/plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java @@ -668,10 +668,10 @@ public class NsxApiClient { List services = serviceList.getResults(); List matchedDefaultSvc = services.parallelStream().filter(svc -> - (svc.getServiceEntries().get(0) instanceof L4PortSetServiceEntry) && - ((L4PortSetServiceEntry) svc.getServiceEntries().get(0)).getDestinationPorts().get(0).equals(port) - && (((L4PortSetServiceEntry) svc.getServiceEntries().get(0)).getL4Protocol().equals(protocol))) - .map(svc -> ((L4PortSetServiceEntry) svc.getServiceEntries().get(0)).getDestinationPorts().get(0)) + (svc.getServiceEntries().get(0)._getDataValue().getField("resource_type").toString().equals("L4PortSetServiceEntry")) && + svc.getServiceEntries().get(0)._getDataValue().getField("destination_ports").toString().equals("["+port+"]") + && svc.getServiceEntries().get(0)._getDataValue().getField("l4_protocol").toString().equals(protocol)) + .map(svc -> svc.getServiceEntries().get(0)._getDataValue().getField("parent_path").toString()) .collect(Collectors.toList()); if (!CollectionUtils.isEmpty(matchedDefaultSvc)) { return matchedDefaultSvc.get(0); diff --git a/ui/src/views/network/VpcTiersTab.vue b/ui/src/views/network/VpcTiersTab.vue index bda759d8c82..8bb84392bd3 100644 --- a/ui/src/views/network/VpcTiersTab.vue +++ b/ui/src/views/network/VpcTiersTab.vue @@ -475,6 +475,7 @@ export default { fetchData () { this.networks = this.resource.network this.fetchMtuForZone() + this.getVpcNetworkOffering() if (!this.networks || this.networks.length === 0) { return } @@ -483,7 +484,6 @@ export default { this.fetchVMs(network.id) } this.publicLBNetworkExists() - this.getVpcNetworkOffering() }, fetchMtuForZone () { api('listZones', { @@ -524,9 +524,9 @@ export default { api('listVPCOfferings', { id: this.resource.vpcofferingid }).then(json => { - var vpcOffering = json?.listvpcofferingsresponse?.vpcoffering[0] - this.isOfferingNatMode = vpcOffering?.nsxmode === 'NATTED' || false + const vpcOffering = json?.listvpcofferingsresponse?.vpcoffering[0] resolve(vpcOffering) + this.isOfferingNatMode = vpcOffering?.nsxmode === 'NATTED' || false }).catch(e => { reject(e) })