From 9ce7ef49cf997766d19892f8b0aa63a6f5ab3d4c Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 20 Sep 2024 10:17:12 +0200 Subject: [PATCH] build/packaging: build tungsten plugin only if noredist is passed (#9006) --- client/pom.xml | 21 ++--- plugins/hypervisors/kvm/pom.xml | 5 -- .../agent/api/SetupTfRouteCommand.java | 64 ++++++++++++++ .../api/SetupTungstenVRouterCommand.java | 77 +++++++++++++++++ .../UpdateTungstenLoadbalancerSslCommand.java | 83 +++++++++++++++++++ ...pdateTungstenLoadbalancerStatsCommand.java | 71 ++++++++++++++++ plugins/network-elements/tungsten/pom.xml | 7 -- plugins/pom.xml | 2 +- server/pom.xml | 11 --- .../com/cloud/network/NetworkServiceImpl.java | 6 +- 10 files changed, 306 insertions(+), 41 deletions(-) create mode 100644 plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTfRouteCommand.java create mode 100644 plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTungstenVRouterCommand.java create mode 100644 plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerSslCommand.java create mode 100644 plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerStatsCommand.java diff --git a/client/pom.xml b/client/pom.xml index 9173e369560..53baebbc2b4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -27,18 +27,7 @@ cloudstack 4.19.2.0-SNAPSHOT - - - juniper-tungsten-api - https://github.com/radu-todirica/tungsten-api/raw/master - - - - net.juniper.tungsten - juniper-tungsten-api - 2.0 - javax.servlet javax.servlet-api @@ -282,11 +271,6 @@ cloud-plugin-network-ovs ${project.version} - - org.apache.cloudstack - cloud-plugin-network-tungsten - ${project.version} - org.apache.cloudstack cloud-plugin-network-elb @@ -1088,6 +1072,11 @@ cloud-plugin-network-cisco-vnmc ${project.version} + + org.apache.cloudstack + cloud-plugin-network-tungsten + ${project.version} + org.apache.cloudstack cloud-plugin-api-vmware-sioc diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml index ad684b6e65f..de5a02c7f7e 100644 --- a/plugins/hypervisors/kvm/pom.xml +++ b/plugins/hypervisors/kvm/pom.xml @@ -83,11 +83,6 @@ ${project.version} compile - - org.apache.cloudstack - cloud-plugin-network-tungsten - ${project.version} - diff --git a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTfRouteCommand.java b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTfRouteCommand.java new file mode 100644 index 00000000000..8ccbff96d79 --- /dev/null +++ b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTfRouteCommand.java @@ -0,0 +1,64 @@ +// 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. +package org.apache.cloudstack.network.tungsten.agent.api; + +import com.cloud.agent.api.Command; + +import java.util.Objects; + +public class SetupTfRouteCommand extends Command { + private final String privateIp; + private final String publicIp; + private final String srcNetwork; + + public SetupTfRouteCommand(final String privateIp, final String publicIp, final String srcNetwork) { + this.privateIp = privateIp; + this.publicIp = publicIp; + this.srcNetwork = srcNetwork; + } + + public String getPrivateIp() { + return privateIp; + } + + public String getPublicIp() { + return publicIp; + } + + public String getSrcNetwork() { + return srcNetwork; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + SetupTfRouteCommand that = (SetupTfRouteCommand) o; + return Objects.equals(privateIp, that.privateIp) && Objects.equals(publicIp, that.publicIp) && Objects.equals(srcNetwork, that.srcNetwork); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), privateIp, publicIp, srcNetwork); + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTungstenVRouterCommand.java b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTungstenVRouterCommand.java new file mode 100644 index 00000000000..00fc522363d --- /dev/null +++ b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/SetupTungstenVRouterCommand.java @@ -0,0 +1,77 @@ +// 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. +package org.apache.cloudstack.network.tungsten.agent.api; + +import com.cloud.agent.api.Command; + +import java.util.Objects; + +public class SetupTungstenVRouterCommand extends Command { + private final String oper; + private final String inf; + private final String subnet; + private final String route; + private final String vrf; + + public SetupTungstenVRouterCommand(final String oper, final String inf, final String subnet, final String route, + final String vrf) { + this.oper = oper; + this.inf = inf; + this.subnet = subnet; + this.route = route; + this.vrf = vrf; + } + + public String getOper() { + return oper; + } + + public String getInf() { + return inf; + } + + public String getSubnet() { + return subnet; + } + + public String getRoute() { + return route; + } + + public String getVrf() { + return vrf; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + SetupTungstenVRouterCommand that = (SetupTungstenVRouterCommand) o; + return Objects.equals(oper, that.oper) && Objects.equals(inf, that.inf) && Objects.equals(subnet, that.subnet) && Objects.equals(route, that.route) && Objects.equals(vrf, that.vrf); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), oper, inf, subnet, route, vrf); + } + + @Override + public boolean executeInSequence() { + return false; + } +} diff --git a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerSslCommand.java b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerSslCommand.java new file mode 100644 index 00000000000..5ab24c18aa0 --- /dev/null +++ b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerSslCommand.java @@ -0,0 +1,83 @@ +// 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. +package org.apache.cloudstack.network.tungsten.agent.api; + +import com.cloud.agent.api.Command; + +import java.util.Objects; + +public class UpdateTungstenLoadbalancerSslCommand extends Command { + private final String lbUuid; + private final String sslCertName; + private final String certificateKey; + private final String privateKey; + private final String privateIp; + private final String port; + + public UpdateTungstenLoadbalancerSslCommand(final String lbUuid, final String sslCertName, + final String certificateKey, final String privateKey, final String privateIp, final String port) { + this.lbUuid = lbUuid; + this.sslCertName = sslCertName; + this.certificateKey = certificateKey; + this.privateKey = privateKey; + this.privateIp = privateIp; + this.port = port; + } + + public String getLbUuid() { + return lbUuid; + } + + public String getSslCertName() { + return sslCertName; + } + + public String getCertificateKey() { + return certificateKey; + } + + public String getPrivateKey() { + return privateKey; + } + + public String getPrivateIp() { + return privateIp; + } + + public String getPort() { + return port; + } + + @Override + public boolean executeInSequence() { + return false; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + UpdateTungstenLoadbalancerSslCommand that = (UpdateTungstenLoadbalancerSslCommand) o; + return Objects.equals(lbUuid, that.lbUuid) && Objects.equals(sslCertName, that.sslCertName) && Objects.equals(certificateKey, that.certificateKey) && Objects.equals(privateKey, that.privateKey) && Objects.equals(privateIp, that.privateIp) && Objects.equals(port, that.port); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), lbUuid, sslCertName, certificateKey, privateKey, privateIp, port); + } +} diff --git a/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerStatsCommand.java b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerStatsCommand.java new file mode 100644 index 00000000000..d7b2088bcd7 --- /dev/null +++ b/plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/network/tungsten/agent/api/UpdateTungstenLoadbalancerStatsCommand.java @@ -0,0 +1,71 @@ +// 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. +package org.apache.cloudstack.network.tungsten.agent.api; + +import com.cloud.agent.api.Command; + +import java.util.Objects; + +public class UpdateTungstenLoadbalancerStatsCommand extends Command { + private final String lbUuid; + private final String lbStatsPort; + private final String lbStatsUri; + private final String lbStatsAuth; + + public UpdateTungstenLoadbalancerStatsCommand(final String lbUuid, final String lbStatsPort, + final String lbStatsUri, final String lbStatsAuth) { + this.lbUuid = lbUuid; + this.lbStatsPort = lbStatsPort; + this.lbStatsUri = lbStatsUri; + this.lbStatsAuth = lbStatsAuth; + } + + public String getLbUuid() { + return lbUuid; + } + + public String getLbStatsPort() { + return lbStatsPort; + } + + public String getLbStatsUri() { + return lbStatsUri; + } + + public String getLbStatsAuth() { + return lbStatsAuth; + } + + @Override + public boolean executeInSequence() { + return false; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + UpdateTungstenLoadbalancerStatsCommand that = (UpdateTungstenLoadbalancerStatsCommand) o; + return Objects.equals(lbUuid, that.lbUuid) && Objects.equals(lbStatsPort, that.lbStatsPort) && Objects.equals(lbStatsUri, that.lbStatsUri) && Objects.equals(lbStatsAuth, that.lbStatsAuth); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), lbUuid, lbStatsPort, lbStatsUri, lbStatsAuth); + } +} diff --git a/plugins/network-elements/tungsten/pom.xml b/plugins/network-elements/tungsten/pom.xml index 2f0bb0f8076..92e520a0ffd 100644 --- a/plugins/network-elements/tungsten/pom.xml +++ b/plugins/network-elements/tungsten/pom.xml @@ -30,13 +30,6 @@ ../../pom.xml - - - juniper-tungsten-api - https://github.com/radu-todirica/tungsten-api/raw/master - - - net.juniper.tungsten diff --git a/plugins/pom.xml b/plugins/pom.xml index a7f0ebd5ed1..27d316f56c1 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -111,7 +111,6 @@ network-elements/stratosphere-ssp network-elements/brocade-vcs network-elements/vxlan - network-elements/tungsten outofbandmanagement-drivers/ipmitool outofbandmanagement-drivers/nested-cloudstack @@ -230,6 +229,7 @@ hypervisors/vmware network-elements/cisco-vnmc network-elements/juniper-contrail + network-elements/tungsten diff --git a/server/pom.xml b/server/pom.xml index 782d194fe9e..df4ebdb8237 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -26,12 +26,6 @@ cloudstack 4.19.2.0-SNAPSHOT - - - juniper-tungsten-api - https://github.com/radu-todirica/tungsten-api/raw/master - - @@ -187,11 +181,6 @@ metrics-jvm 3.0.2 - - net.juniper.tungsten - juniper-tungsten-api - 2.0 - diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java index 0fa5a0d6db3..d0711a9fcf9 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -4042,7 +4042,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C addDefaultInternalLbProviderToPhysicalNetwork(pNetwork.getId()); //Add tungsten network service provider - addDefaultTungstenProviderToPhysicalNetwork(pNetwork.getId()); + try { + addDefaultTungstenProviderToPhysicalNetwork(pNetwork.getId()); + } catch (Exception ex) { + s_logger.warn("Failed to add Tungsten provider to physical network due to:" + ex.getMessage()); + } // Add the config drive provider addConfigDriveToPhysicalNetwork(pNetwork.getId());