Skip to content

Commit 632b038

Browse files
committed
Update as suggested
1 parent ca2a5d3 commit 632b038

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

api/src/main/java/com/cloud/network/Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static Routing fromValue(String type) {
8989
} else if (type.equalsIgnoreCase("Dynamic")) {
9090
return Dynamic;
9191
} else {
92-
throw new InvalidParameterValueException("Unexpected Routing type : " + type);
92+
throw new InvalidParameterValueException("Unexpected Routing mode : " + type);
9393
}
9494
}
9595
}

api/src/main/java/org/apache/cloudstack/api/response/NetworkResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
296296
private String internetProtocol;
297297

298298
@SerializedName(ApiConstants.IPV6_ROUTING)
299-
@Param(description = "The IPv6 routing type of network offering", since = "4.17.0")
299+
@Param(description = "The IPv6 routing mode of network offering", since = "4.17.0")
300300
private String ipv6Routing;
301301

302302
@SerializedName(ApiConstants.IPV6_ROUTES)
@@ -320,7 +320,7 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
320320
private String ipv6Dns2;
321321

322322
@SerializedName(ApiConstants.IPV4_ROUTING)
323-
@Param(description = "The IPv4 routing type of network", since = "4.20.0")
323+
@Param(description = "The IPv4 routing mode of network", since = "4.20.0")
324324
private String ipv4Routing;
325325

326326
@SerializedName(ApiConstants.IPV4_ROUTES)

api/src/main/java/org/apache/cloudstack/api/response/VpcResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class VpcResponse extends BaseResponseWithAnnotations implements Controll
166166
private String ipv4Routing;
167167

168168
@SerializedName(ApiConstants.IPV6_ROUTING)
169-
@Param(description = "The Ipv6 routing type of VPC", since = "4.22.1")
169+
@Param(description = "The IPv6 routing mode of VPC", since = "4.22.1")
170170
private String ipv6Routing;
171171

172172
@SerializedName(ApiConstants.IPV4_ROUTES)

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3586,16 +3586,14 @@ public VpcResponse createVpcResponse(ResponseView view, Vpc vpc) {
35863586

35873587
// add IPv6 routes
35883588
ipv6Service.updateIpv6RoutesForVpcResponse(vpc, response);
3589-
if (CollectionUtils.isNotEmpty(response.getIpv6Routes())) {
3590-
if (Objects.nonNull(asNumberVO)) {
3591-
response.setIpv6Routing(Network.Routing.Dynamic.name());
3592-
} else {
3593-
response.setIpv6Routing(Network.Routing.Static.name());
3594-
}
3589+
if (Objects.nonNull(asNumberVO)) {
3590+
response.setIpv6Routing(Network.Routing.Dynamic.name());
3591+
} else {
3592+
response.setIpv6Routing(Network.Routing.Static.name());
35953593
}
35963594

35973595
// Add BGP peer information for full view
3598-
if (view == ResponseView.Full) {
3596+
if (view == ResponseView.Full && Objects.nonNull(asNumberVO)) {
35993597
List<BgpPeerVO> bgpPeerVOS = bgpPeerDao.listNonRevokeByVpcId(vpc.getId());
36003598
for (BgpPeerVO bgpPeerVO : bgpPeerVOS) {
36013599
BgpPeerResponse bgpPeerResponse = routedIpv4Manager.createBgpPeerResponse(bgpPeerVO);

ui/src/views/infra/zone/BgpPeersTab.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
<template>
1919
<a-spin :spinning="componentLoading">
2020
<a-alert
21-
v-if="this.resource.ip4routing || this.resource.ip6routing"
21+
v-if="isIpRoutingEnabled()"
2222
type="info">
2323
<template #message>
2424
<div v-html="$t('message.bgp.peers.null')" />
2525
</template>
2626
</a-alert>
2727
<br>
2828
<a-button
29-
v-if="!(this.resource.ip4routing || this.resource.ip6routing)"
29+
v-if="!isIpRoutingEnabled()"
3030
:disabled="!('createBgpPeer' in $store.getters.apis)"
3131
type="primary"
3232
style="margin-bottom: 20px; width: 100%"
@@ -56,7 +56,7 @@
5656
<template v-if="column.key === 'project'">
5757
{{ record.project }}
5858
</template>
59-
<template v-if="column.key === 'actions' && !(this.resource.ip4routing || this.resource.ip6routing)">
59+
<template v-if="column.key === 'actions' && !isIpRoutingEnabled()">
6060
<div
6161
class="actions"
6262
style="text-align: right" >
@@ -103,7 +103,7 @@
103103
</template>
104104
</a-table>
105105
<a-pagination
106-
v-if="!(this.resource.ip4routing || this.resource.ip6routing)"
106+
v-if="!isIpRoutingEnabled()"
107107
class="row-element pagination"
108108
size="small"
109109
:current="bgpPeersPage"
@@ -318,7 +318,7 @@
318318

319319
<br>
320320
<a-button
321-
v-if="(this.resource.ip4routing || this.resource.ip6routing) && this.$route.meta.name === 'guestnetwork'"
321+
v-if="isIpRoutingEnabled() && this.$route.meta.name === 'guestnetwork'"
322322
type="primary"
323323
style="margin-bottom: 20px; width: 100%"
324324
@click="() => { changeBgpPeersForNetworkModal = true }"
@@ -327,7 +327,7 @@
327327
{{ $t('label.change.bgp.peers') }}
328328
</a-button>
329329
<a-button
330-
v-if="(this.resource.ip4routing || this.resource.ip6routing) && this.$route.meta.name === 'vpc'"
330+
v-if="isIpRoutingEnabled() && this.$route.meta.name === 'vpc'"
331331
type="primary"
332332
style="margin-bottom: 20px; width: 100%"
333333
@click="() => { changeBgpPeersForVpcModal = true }"
@@ -456,6 +456,9 @@ export default {
456456
asnumber: [{ required: true, message: this.$t('label.required') }]
457457
})
458458
},
459+
isIpRoutingEnabled () {
460+
return !!(this.resource && (this.resource.ip4routing || this.resource.ip6routing))
461+
},
459462
fetchDomains () {
460463
this.domainsLoading = true
461464
getAPI('listDomains', {
@@ -474,7 +477,7 @@ export default {
474477
})
475478
},
476479
fetchData () {
477-
if (this.resource.ip4routing || this.resource.ip6routing) {
480+
if (this.isIpRoutingEnabled()) {
478481
this.bgpPeers = this.resource.bgppeers
479482
} else {
480483
this.fetchZoneBgpPeer()

0 commit comments

Comments
 (0)