mirror of https://github.com/apache/cloudstack.git
FR01: Netris Integration (#1)
* Add Netris module and Add netris provider * Fix * Add Netris Provider to the zone creation wizard * add steps to zone wizard for adding netris controller and public traffic * cleanup * Add missing config key * Add routed mode offerings for Netris VPC (#3) * Add routed mode offerings for Netris VPC * update vpc offering name * generalize the offering creation method for network providers * log * remove debug log * fix failing build * Add dependency and Netris API client (#4) * Add dependency and first approach to Netris API client * Fix authentication and create Netris API client, in progress sites listing * Fix get sites * Support for listing VPCs (#5) * List tenants * Delegate API classes creation to the SDK and simply invoke the desired API class through CloudStack (#7) * Delegate API classes creation to the SDK and simply invoke the desired API class through CloudStack * Pass default auth scheme for now * Support adding netris provider to CloudStack and Netris VPC Creation (#6) * Support adding netris provider to CloudStack * revert marvin change * add license and perform session check when provider is added * add license and remove unused import * fix build failure - uunused imports * address comments * fix provider name * add Netris network element * add license * Add netris management APIs and netris service provider * add license * revert change * remove other network elements from Netris element * fix api name in doc generator * remove logs * move session alive check to CheckHealthCommand exec * Fix zone creation wizard to configure netris provider * Upgrade GSON version - from PR 8756 * Add additional parametes to the add Netris provider API * add netris as a host * add additional params to the resoponse and update UI * Rename site to site_name * Create Netris VPC (#8) * Delegate API classes creation to the SDK and simply invoke the desired API class through CloudStack (#7) * Delegate API classes creation to the SDK and simply invoke the desired API class through CloudStack * Pass default auth scheme for now * Drop for_nsx and for_tungten columns in favour of checking the provider on the ntwserviceprovider map table * Remove missing setForTungsten occurrence * Remove forNsx from VPC offerings * Create Netris VPC * Fix VPC offerings listing and remove unused dao * Create VPC fixes * Upgrade GSON version - from PR 8756 * Fix VPC creation response by using the latest SDK code * Fix unit test * Remove unused import * Fix NSX unit tests after refactoring * Add Netris key to the VLAN Details table (#10) * Add Netris key to the VLAN Details table * update for_<provider> column to be generic * Fix VPC and add IPAM allocation for the VPC CIDR (#9) * Fix VPC and add IPAM allocation for the VPC CIDR * Remove VPC logic * Use zoneId accountId and domainId on resources creation * Fix naming * Fix VR public nic issue * Fix Netris Public IP for VPC source NAT allocation * Add Netris VPC Subnets and vNets (#11) * Add Netris VPC Subnets and vNets * fix compilation errors * Add netris subnet * refactor naming convention to differentiate between VPC tiers and Isolated networks * revert marvin change * fix constructor - build failure * Add support to filter netris offerings, delete netris provider when zone is being deleted * Fix build * Fix VPC creation * Fix vnet creation * unnecesary log --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> --------- Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Fix unit tests * Add support to delete VNets and Subnets (#13) * Add support to delete VNets and Subnets * Add support to delete vnet resources * Add support to delete vnet resources * extract code to method --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Add missing suffix return (#14) * Set up Netris Public range on new zone addition (#15) * Set up Netris Public range on new zone addition * Add dependency to calculate subnet containing a start and end IP * Remove unused import * Move dependency to the netris module * Rename Netris IP range * Refactor logic * Revert "Refactor logic" This reverts commit 7ec36a81320444c37e7bb914dd895060b663411b. * Fix setup range after adding Netris Provider * Fix VXLAN range adding on zone creation * Pass VXLAN ID during creation of Netris vNets (#16) * add zone params to accepts management vnet * Release vxlan associated to the netris broadcast domain type * handle update network broadcast uri * Update Subnet purpose for Netris Public Traffic (#17) * Update Subnet purpose for Netris Public Traffic * search for existing subnet of common purpose type * Fix VR Public IP address (#20) * Fix VR Public IP address * Do not set the Public IP range on Netris side that is not part of the Netris IP Public Pool * Leave only systemvms tag for the first element * Fix NSX compatibility * Pass network gateway instead of network CIDR for Netris vNet creation (#21) * Run moodifyvxlan script if broadcast domain type is Netris (#18) * Add support to create Netris VPC / Network offerings (#22) * Add support to create Netris VPC / Network offerings * fix support services for netris provider type * Phase4 - Add support for Source NAT, Static NAT and Port Forwarding (#19) * Run moodifyvxlan script if broadcast domain type is Netris * Add Netris NAT offerings * Add support to add Source nat rules for Natted offering * fix api params while creating Netris source NAT rule * Add support to add and delete source nat rule on netris * Add support to create /32 NAT subnet * Add support to add and delete Static NAT rules in Netris (#23) * Add support to add and delete Static NAT rules in Netris * fix static nat creation on netris & removal of subnet on deletion of static nat rule * remove nat subnet after deltion of the static nat rule * add check to see if subnet already exists and add license header * Add port forwarding rules as DNAT rules in Netris (#24) * Add port forwarding rules as DNAT rules in Netris * Fixes * Allow removing DNAT rules * Fixes * Fix subnet search * Fix update SNAT only for SNAT rules * Address comments * Fix * Fix netris pom xml * Fix SNAT rule creation * Fix IP and port placements (#27) * Fix IP and port placements * fix dnat to IP for PF rules * change dnatport --------- Co-authored-by: Nicolas Vazquez <nicovazquez90@gmail.com> * List only Netris Public IPs for NAT operations (#26) * List only Netris Public IPs for NAT operations * rename getter and change type * fix failing unit tests * list all IPs if forProvider is not passed * fix list public IPs for external providers with additional IP range * filter provider Ips in a zone with external provider setup * Prevent acquiring IP that is not from the external provider range * formating --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Support to pass provider when creating public ip range and create IPAM on Netris (#28) * UI: support to pass provider when creating public ip range * prevent adding public ip range for a provider that isnt supported in zone * Create public range on Netris when created on CloudStack --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Revert UI filtration for public IPs (#29) * Fix issue with pagination of public addresses listed after filtering for external providers * Revert UI filteration for public IPs for external network provider enabled zones * Fix unit tests (#30) * Add Netris Tag parameter to the Network provider and fix zone creation wizard (#33) * Add Netris Tag parameter to the Network provider * remove unused import * Fix public IP ranges creation on zone creation (#34) * use single quotes --------- Co-authored-by: Nicolas Vazquez <nicovazquez90@gmail.com> * Fix SourceAddress for SNAt to VPC cidr (#35) * Fix VPC/network offering service list for external network providers in Routed mode (#32) * Fix network offering service list for external network providers in Routed mode * filter out unsupported services based on network mode * fix supported services list for vpc offering for external providers in Routed mode * Add support to add and delete and update static routes on Netris (#37) * Add support to add static routes in Netris * support to delete static routes on netris * add defensive check for nextHop * Add support to update static routes * add state * pass empty list for switched to avoid timeout * Netris: search static route by name and next hop if exists --------- Co-authored-by: Wei Zhou <weizhou@apache.org> * Netris FR1b: Support Remote Access VPN and Site-to-Site VPN in VPC VR (#41) * Static Routes: support nexthop * Update api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> * PR#10064 VR: apply iptables rules when add/remove static routes * PR#10065 UI: fix cannot open 'Edit tags' modal for static routes * PR#10066 Static Routes: fix check on wrong global configuration * PR#10067 VR: fix site-2-site VPN if split connections is enabled * PR#10081 server: do not allocate nic on public network for NSX VPC VR * PR#10082 UI: create VPC network offering with conserve mode * PR#10083 VR: allow outgoing traffic from RAS/VPN clients * PR#10086 server: fix typo removeaccessvpn in VirtualRouterElement * server: Add check on Public IP for remote access VPN * Revert "PR#10083 VR: allow outgoing traffic from RAS/VPN clients" This reverts commit 2f9b9f428947cac91de322fbdf4a980902a1c0a0. * VPC: fetch same used IP for domain router if VR is not Source NAT * VR: pass has_public_network to VR and configure RA/S2S VPN left peers * Revert "PR#10081 server: do not allocate nic on public network for NSX VPC VR" This reverts commit 809e269ed6b361d9df1fcef6537762c5612863e0. * VPC: fetch same used IP for domain router if VR is not Source NAT (v2) * VR: fix /etc/hosts and nameservers in dnsmasq.conf if VPC VR is not guest gateway prior to this PR ``` root@r-1167-VM:~# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 r-1167-VM ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.21.1.33 dummy-vpc-vpn-001 172.21.1.1 r-1167-VM data-server root@r-1167-VM:~# cat /etc/dnsmasq.d/cloud.conf dhcp-hostsfile=/etc/dhcphosts.txt listen-address=127.0.0.1,172.21.1.234 dhcp-range=set:interface-eth1-0,172.21.1.234,static dhcp-option=tag:interface-eth1-0,15,cs2cloud.internal dhcp-option=tag:interface-eth1-0,6,172.21.1.1,10.0.32.1,8.8.8.8 dhcp-option=tag:interface-eth1-0,3,172.21.1.1 dhcp-option=eth1,26,1500 dhcp-option=tag:interface-eth1-0,1,255.255.255.0 ``` the lines should be ``` 172.21.1.234 r-1167-VM data-server dhcp-option=tag:interface-eth1-0,6,10.0.32.1,8.8.8.8 ``` * server: Enable static NAT for Domain router if it is not Source NAT * server: Enable static NAT for Domain router on UI * server: assign Public IP to VPC VR and enable static nat if VR is not Source NAT * server: configure dns1 if VR is not Source NAT * server: remove check on Firewall service when list network service providers * UI: remove dot from message.enabled.vpn * systemvm: add default route via first guest gateway if VR does not have public IP/interface * VR: add fw_dhcpserver for shared network * VR: pass has_public_network to VR and configure RA/S2S VPN left peers (v2) * UI: fix request error when create a VPC tier in a non-Netris/NSX env * systemvm: add default route via first guest gateway (v2) * VR: configure iptables rules for S2S vpn on first guest interface * VR: allow FORWARD to guest interfaces if VR is not Public * VR: configure remote access vpn on first guest interface if not public * VR: fix error 789 in RA VPN client when both RA and S2S are configured * server: Apply Static Route for RA/S2S VPN in VPC VR * VR: do not set mark for Public interface when VR is not really public * VPN: do not disable static nat if it is used by a RA/S2S VPN * server: skip check on network conserve mode if disable/enable RA VPN on Router IP * server: set forRouter to false when release a IP * VR: diable IP spoofing protection on default guest network * VR: fix iptables rules only when only S2S vpn is enabled * UI: show 'VPN Connections' section * VPC: new methods to configure/reconfigure Static NAT for VPC VR * API: set Type in ip address response to DomainRouter if it is used by VR * server: do not allow IP release if it is used by RA or S2S VPN gateway * VR: check if interface is added * VR: add default route only when ip is associated to first guest interface * VR: fix ipsec conf for l2tp and s2s vpn * server: save placeholder IP for VPC VR to fix the new VR IP when vpc tier is auto-shutdown * server: get non-placeholder NIC for VPC VR * VR: wait 15 seconds after starting password server * server: fix unable to configure static nat due to 'invalid virtual machine id' * UI: fix link of router in info card * VPC: apply static route for VPC VPN if needed (refactoring) * server: fix VR IP of first VPC tier is the VM gateway * server: update or remove all existing static routes when shutdown a network * server: update ipaddress after disabling static nat to fix vpc deletion issue * servr: disable remote access VPN as part of VPC dstroy * server: apply static routes when implement a vpc tier * server: apply static routes even if next hop is null * server: fix Cannot invoke "com.cloud.vm.NicProfile.getRequestedIPv4()" because "requested" is null * Netris: Update Vpn provider to VpcVirtualRouter * Netris: Add Vpn service to network offerings and networks * server: fix CIDR of VPN ip range * server: set isVrGuestGateway by SoureNat/Gateway service with Provider.VPCVirtualRouter * VR: password server takes 10-15 seconds to start if VR IP is not configured in /etc/hosts * Netris: add back routesPutBody.setStateStatus * engine/schema: remove SQL changes in schema-41910to42000.sql --------- Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> * Add support for Gateway service for Netris VPC and network offerings (#39) * Add support for Gateway service for Netris VPC and network offerings * Restore UserData service * add gateway only to vpc service * Add support for gateway service for external network providers for networks in routed mode * add support for gateway svc * Revert "add support for gateway svc" This reverts commit 06645cd1c6d08a81ede5d1431497ea3f2efdc5dc. * Fix VPC offering creation * Fix VR public NIC after Gateway service is set to Netris --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> * Netris VPN: Fix s2s vpn status update and isolated network implementation (#42) * server: fix NPE when deploy vm on isolated network * vpn: fix s2s vpn status is not updated Prior to this fix ``` java.lang.IllegalArgumentException: Class com.cloud.agent.api.CheckS2SVpnConnectionsAnswer declares multiple JSON fields named 'details'; conflict is caused by fields com.cloud.agent.api.CheckS2SVpnConnectionsAnswer#details and com.cloud.agent.api.Answer#details at com.cloud.agent.transport.ResponseTest.testCheckS2SVpnConnectionsAnswer(ResponseTest.java:42) ``` * test: fix test_01_vpn_usage as now it is only possible to create VPN on Source NAT if it uses VR * VR: fix unable to create remote access VPN on regular isolated network the error is ``` File "/opt/cloud/bin/configure.py", line 1242, in process self.remoteaccessvpn_iptables(self.dbag['public_interface'], public_ip, self.dbag[public_ip]) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ KeyError: 'public_interface' ``` * Release NAT IP subnet when VPC is removed or IP is released (#44) * Release NAT IP subnet when VPC is removed or IP is released * add license * Add support to add IPv6 Public IP range as IPAM Allocation / Subnet on Netris (#36) * Add support to add IPv6 Public IP range as IPAM Allocation / Subnet on Netris * Add ipam alloc and subnet for the ipv6 subnet associated to the vpc tier network * remove commented code * Phase5 - Support for ACLs in Netris (#31) * Add support for Netris ACLs * acl support * Make acl api call to netris to create the rule * refactor add acl rule to populate the right fields * support icmp type acl rule * acl rule creation - move netrisnetworkRule * Update ACL naming on Netris * Add support for Deletion of netris acls * Add support to delete and re-order ACL rules * support creation of default acl rules and replacing acl rules * fix NSXNetworkRule * Add global routing flag on subnet creation (#45) * Support change snat ip (#46) * Support updating VPC Source NAT IP * Optimize code * Update source NAT IP * Fix naming convention for NAT subnets to follow other resources (#47) * Fix naming convention for NAT subnets to follow other resources * Use vpc ID for nat subnets * Use new nat subnet name for deletion of static nat rule * fix naming convevntion for nat subnet * Keep Vpn service to default VPC offering with Natted mode only (#50) * Add Vpn service to default VPC offering with Routed mode * Revert change on VPC offering and fix VPN service only for Netris NAT mode * Validate if given CIDR belongs to a bigger allocation in Netris before creating the zone-level allocation (#48) * Validate if given CIDR belongs to a bigger allocation in Netris before creating * rename method * Phase5 - Support for LB - create, delete and Update operations (#49) * Add support for Netris ACLs * acl support * Make acl api call to netris to create the rule * refactor add acl rule to populate the right fields * support icmp type acl rule * acl rule creation - move netrisnetworkRule * Update ACL naming on Netris * Add support for Deletion of netris acls * Add support to delete and re-order ACL rules * support creation of default acl rules and replacing acl rules * fix NSXNetworkRule * Fix naming convention for NAT subnets to follow other resources * Use vpc ID for nat subnets * Phase5 - Support for LB - create, delete and Update operations * Use new nat subnet name for deletion of static nat rule * add support to add netris lb rule * support deletion of LB rule on Netris * add checks when editing unsupported fields of LB rule for Netris and hide columns on the UI * fix test failure * fix imports * add license * address comments * Enable Autoscaling on Netris for CPU and memory (#51) * Enable Autoscaling on Netris for CPU and memory * Fix monitor autoscale group and cleanup * Rename autoscaling group method * Integrate Autoscaling by allowing to update LB rules * Refactor according to the SDK changes * Fix the test failures noticed on #44 (#52) * Increase code coverage (#54) * Increase code coverage * More unit tests * Remove credentials and mock api client * NetrisResource tests * Fix unit test * Add support to add and remove ACL rules when CIDR list is passed when creating LB rules (#53) * Add support to add and remove ACL rules when CIDR list is passed when creating LB rules * add deny all rule * delete the deny rule as well * Fix build (#57) * Prevent Index Out of Bounds exception when naming IPAM subnets (#58) * Prevent Index Out of Bounds exception when naming IPAM subnets * fix linter * Delete netris IPv6 subnet (#59) * Netris VPN: add static route when update a non-existent static route (#60) * Fix VPC tier creation failure - prevent creating IPv6 IPAM allocation if it already exists (#61) * Update netris VPC and tier name (#56) * Update netris VPC and tier name * add support to update vpc tier name * add license * support editing names of dual stack VPCs * VR/server: configure default gateway and RA/S2S VPN on the IP/interface with minimum network_id (#43) * server: fix NPE when deploy vm on isolated network * vpn: fix s2s vpn status is not updated Prior to this fix ``` java.lang.IllegalArgumentException: Class com.cloud.agent.api.CheckS2SVpnConnectionsAnswer declares multiple JSON fields named 'details'; conflict is caused by fields com.cloud.agent.api.CheckS2SVpnConnectionsAnswer#details and com.cloud.agent.api.Answer#details at com.cloud.agent.transport.ResponseTest.testCheckS2SVpnConnectionsAnswer(ResponseTest.java:42) ``` * test: fix test_01_vpn_usage as now it is only possible to create VPN on Source NAT if it uses VR * VR: fix unable to create remote access VPN on regular isolated network the error is ``` File "/opt/cloud/bin/configure.py", line 1242, in process self.remoteaccessvpn_iptables(self.dbag['public_interface'], public_ip, self.dbag[public_ip]) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ KeyError: 'public_interface' ``` * VR/server: configure default gateway and RA/S2S VPN on the IP/interface with minimum network_id * Don't add deny rule if no CIDR list is passed (#62) * Hide the Stickiness Configure button for Netris Load Balancers (#72) * Update IPAM subnet purpose to nat before NAT operations if its different (#71) * Netris VPN: create vpc gateway with specified IP (#63) * Netris: fix UnsupportedOperationException when create VPC offering with NATTED mode (#75) fixes ``` 2025-03-21T10:42:55,039 ERROR [c.c.a.ApiServer] (qtp1513608173-21:[ctx-f9c7f002, ctx-bcfe846d]) (logid:e12e798f) unhandled exception executing api command: [Ljava.lang.String;@3a1416cd java.lang.UnsupportedOperationException at java.base/java.util.AbstractList.add(AbstractList.java:153) at java.base/java.util.AbstractList.add(AbstractList.java:111) at org.apache.cloudstack.api.command.admin.vpc.CreateVPCOfferingCmd.getServiceProviderMapForExternalProvider(CreateVPCOfferingCmd.java:248) ``` * [UI] Zone wizard creation improvements - rename hostname to url and remove port for Netris Provider (#77) * [UI] Zone wizard creation improvements - rename hostname to url and remove port for Netris Provider * Fix schema column for url instead of hostname * Fix Static NAT rules naming (#83) * Netris: create VPN gateway with specified public IP on UI (#82) * Netris vpn: apply static routes when start or delete a VPN connection (#85) * Netris VPN: apply static routes when start S2S VPN * Netris: list static routes and revoke the routes which are not needed * Netris: use route name (x.x.x.0/x) instead of prefix (x.x.x.0) and get clean cidr list * Netris VPN: fix NPE when list static routes * Update plugins/network-elements/netris/src/main/java/org/apache/cloudstack/service/NetrisApiClientImpl.java * Delete IPv6 allocation after tier removal on VPC with dual stack offering (#86) * Netris pass v6 gateway (#87) * pass v6 gateway to netris * pass v6 gateway to netris * refactor to address comments * remove imports * [VR] Fix IPv6 NIC IP on the VR (#89) * Add support to edit ACL rules (#74) * Add support to edit ACL rules * add support to update acl rules * remove test file * VR: advertise SLAAC prefix only if VR is gateway (#91) * Make reorder ACL items invoke Netris controller (#90) * VR: fix radvd misconfiguration for non-netris env (#92) * [VR] Fix object comparisson to string comparisson on python (#93) * Fix unit tests for ACL (#94) * Use the previously assigned vNet for Netris Network when it transitions to Implemented state after gc (#88) * Use the previously assigned vNet for Netris Network when it transitions to Implemented state after gc * Fix unit tests --------- Co-authored-by: nvazquez <nicovazquez90@gmail.com> --------- Co-authored-by: Pearl Dsilva <pearl1594@gmail.com> Co-authored-by: Wei Zhou <weizhou@apache.org>
This commit is contained in:
parent
d24b6f229d
commit
604137624d
|
|
@ -17,7 +17,11 @@
|
|||
package com.cloud.configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.command.admin.config.ResetCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||
import org.apache.cloudstack.api.command.admin.network.CreateGuestNetworkIpv6PrefixCmd;
|
||||
|
|
@ -372,4 +376,16 @@ public interface ConfigurationService {
|
|||
List<? extends PortableIp> listPortableIps(long id);
|
||||
|
||||
Boolean isAccountAllowedToCreateOfferingsWithTags(IsAccountAllowedToCreateOfferingsWithTagsCmd cmd);
|
||||
|
||||
public static final Map<String, String> ProviderDetailKeyMap = Map.of(
|
||||
Network.Provider.Nsx.getName(), ApiConstants.NSX_DETAIL_KEY,
|
||||
Network.Provider.Netris.getName(), ApiConstants.NETRIS_DETAIL_KEY
|
||||
);
|
||||
|
||||
public static boolean IsIpRangeForProvider(Network.Provider provider) {
|
||||
if (Objects.isNull(provider)) {
|
||||
return false;
|
||||
}
|
||||
return ProviderDetailKeyMap.containsKey(provider.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -495,6 +495,8 @@ public class EventTypes {
|
|||
|
||||
public static final String EVENT_ZONE_VLAN_ASSIGN = "ZONE.VLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VLAN_RELEASE = "ZONE.VLAN.RELEASE";
|
||||
public static final String EVENT_ZONE_VXLAN_ASSIGN = "ZONE.VXLAN.ASSIGN";
|
||||
public static final String EVENT_ZONE_VXLAN_RELEASE = "ZONE.VXLAN.RELEASE";
|
||||
|
||||
// Projects
|
||||
public static final String EVENT_PROJECT_CREATE = "PROJECT.CREATE";
|
||||
|
|
|
|||
|
|
@ -99,4 +99,5 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
|
|||
|
||||
boolean isForSystemVms();
|
||||
|
||||
boolean isForRouter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
public static final Provider Tungsten = new Provider("Tungsten", false);
|
||||
|
||||
public static final Provider Nsx = new Provider("Nsx", false);
|
||||
public static final Provider Netris = new Provider("Netris", false);
|
||||
|
||||
private final String name;
|
||||
private final boolean isExternal;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ public class Networks {
|
|||
UnDecided(null, null),
|
||||
OpenDaylight("opendaylight", String.class),
|
||||
TUNGSTEN("tf", String.class),
|
||||
NSX("nsx", String.class);
|
||||
NSX("nsx", String.class),
|
||||
Netris("netris", String.class);
|
||||
|
||||
private final String scheme;
|
||||
private final Class<?> type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,358 @@
|
|||
// 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 com.cloud.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SDNProviderNetworkRule {
|
||||
|
||||
protected long domainId;
|
||||
protected long accountId;
|
||||
protected long zoneId;
|
||||
protected Long networkResourceId;
|
||||
protected String networkResourceName;
|
||||
protected boolean isVpcResource;
|
||||
protected long vmId;
|
||||
protected long ruleId;
|
||||
protected String publicIp;
|
||||
protected String vmIp;
|
||||
protected String publicPort;
|
||||
protected String privatePort;
|
||||
protected String protocol;
|
||||
protected String algorithm;
|
||||
protected List<String> sourceCidrList;
|
||||
protected List<String> destinationCidrList;
|
||||
protected Integer icmpCode;
|
||||
|
||||
protected Integer icmpType;
|
||||
protected String trafficType;
|
||||
protected Network.Service service;
|
||||
|
||||
public long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public void setDomainId(long domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkResourceId() {
|
||||
return networkResourceId;
|
||||
}
|
||||
|
||||
public void setNetworkResourceId(Long networkResourceId) {
|
||||
this.networkResourceId = networkResourceId;
|
||||
}
|
||||
|
||||
public String getNetworkResourceName() {
|
||||
return networkResourceName;
|
||||
}
|
||||
|
||||
public void setNetworkResourceName(String networkResourceName) {
|
||||
this.networkResourceName = networkResourceName;
|
||||
}
|
||||
|
||||
public boolean isVpcResource() {
|
||||
return isVpcResource;
|
||||
}
|
||||
|
||||
public void setVpcResource(boolean vpcResource) {
|
||||
isVpcResource = vpcResource;
|
||||
}
|
||||
|
||||
public long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public void setVmId(long vmId) {
|
||||
this.vmId = vmId;
|
||||
}
|
||||
|
||||
public long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
public void setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
}
|
||||
|
||||
public String getVmIp() {
|
||||
return vmIp;
|
||||
}
|
||||
|
||||
public void setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
}
|
||||
|
||||
public String getPublicPort() {
|
||||
return publicPort;
|
||||
}
|
||||
|
||||
public void setPublicPort(String publicPort) {
|
||||
this.publicPort = publicPort;
|
||||
}
|
||||
|
||||
public String getPrivatePort() {
|
||||
return privatePort;
|
||||
}
|
||||
|
||||
public void setPrivatePort(String privatePort) {
|
||||
this.privatePort = privatePort;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public void setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public Network.Service getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public void setService(Network.Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Integer getIcmpCode() {
|
||||
return icmpCode;
|
||||
}
|
||||
|
||||
public void setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public List<String> getSourceCidrList() {
|
||||
return sourceCidrList;
|
||||
}
|
||||
|
||||
public void setSourceCidrList(List<String> sourceCidrList) {
|
||||
this.sourceCidrList = sourceCidrList;
|
||||
}
|
||||
|
||||
public List<String> getDestinationCidrList() {
|
||||
return destinationCidrList;
|
||||
}
|
||||
|
||||
public void setDestinationCidrList(List<String> destinationCidrList) {
|
||||
this.destinationCidrList = destinationCidrList;
|
||||
}
|
||||
|
||||
public String getTrafficType() {
|
||||
return trafficType;
|
||||
}
|
||||
|
||||
public void setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public long domainId;
|
||||
public long accountId;
|
||||
public long zoneId;
|
||||
public Long networkResourceId;
|
||||
public String networkResourceName;
|
||||
public boolean isVpcResource;
|
||||
public long vmId;
|
||||
|
||||
public long ruleId;
|
||||
public String publicIp;
|
||||
public String vmIp;
|
||||
public String publicPort;
|
||||
public String privatePort;
|
||||
public String protocol;
|
||||
public String algorithm;
|
||||
public List<String> sourceCidrList;
|
||||
public List<String> destinationCidrList;
|
||||
public String trafficType;
|
||||
public Integer icmpType;
|
||||
public Integer icmpCode;
|
||||
public Network.Service service;
|
||||
|
||||
public Builder() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
public Builder setDomainId(long domainId) {
|
||||
this.domainId = domainId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAccountId(long accountId) {
|
||||
this.accountId = accountId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNetworkResourceId(Long networkResourceId) {
|
||||
this.networkResourceId = networkResourceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNetworkResourceName(String networkResourceName) {
|
||||
this.networkResourceName = networkResourceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVpcResource(boolean isVpcResource) {
|
||||
this.isVpcResource = isVpcResource;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setVmId(long vmId) {
|
||||
this.vmId = vmId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRuleId(long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPublicIp(String publicIp) {
|
||||
this.publicIp = publicIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPublicPort(String publicPort) {
|
||||
this.publicPort = publicPort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPrivatePort(String privatePort) {
|
||||
this.privatePort = privatePort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAlgorithm(String algorithm) {
|
||||
this.algorithm = algorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTrafficType(String trafficType) {
|
||||
this.trafficType = trafficType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSourceCidrList(List<String> sourceCidrList) {
|
||||
this.sourceCidrList = sourceCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDestinationCidrList(List<String> destinationCidrList) {
|
||||
this.destinationCidrList = destinationCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setService(Network.Service service) {
|
||||
this.service = service;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SDNProviderNetworkRule build() {
|
||||
SDNProviderNetworkRule rule = new SDNProviderNetworkRule();
|
||||
rule.setDomainId(this.domainId);
|
||||
rule.setAccountId(this.accountId);
|
||||
rule.setZoneId(this.zoneId);
|
||||
rule.setNetworkResourceId(this.networkResourceId);
|
||||
rule.setNetworkResourceName(this.networkResourceName);
|
||||
rule.setVpcResource(this.isVpcResource);
|
||||
rule.setVmId(this.vmId);
|
||||
rule.setVmIp(this.vmIp);
|
||||
rule.setPublicIp(this.publicIp);
|
||||
rule.setPublicPort(this.publicPort);
|
||||
rule.setPrivatePort(this.privatePort);
|
||||
rule.setProtocol(this.protocol);
|
||||
rule.setRuleId(this.ruleId);
|
||||
rule.setAlgorithm(this.algorithm);
|
||||
rule.setIcmpType(this.icmpType);
|
||||
rule.setIcmpCode(this.icmpCode);
|
||||
rule.setSourceCidrList(this.sourceCidrList);
|
||||
rule.setDestinationCidrList(this.destinationCidrList);
|
||||
rule.setTrafficType(this.trafficType);
|
||||
rule.setService(service);
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||
|
||||
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable {
|
||||
enum State {
|
||||
Pending, Connecting, Connected, Disconnected, Error,
|
||||
Pending, Connecting, Connected, Disconnected, Error, Removed
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.cloud.deploy.DeployDestination;
|
|||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
|
|
@ -87,6 +88,12 @@ public interface NetworkElement extends Adapter {
|
|||
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException;
|
||||
|
||||
/**
|
||||
* Release IP from the network provider if reserved
|
||||
* @param ipAddress
|
||||
*/
|
||||
boolean releaseIp(IpAddress ipAddress);
|
||||
|
||||
/**
|
||||
* The network is being shutdown.
|
||||
* @param network
|
||||
|
|
|
|||
|
|
@ -17,12 +17,40 @@
|
|||
package com.cloud.network.element;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.PortForwardingRule;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
|
||||
public interface PortForwardingServiceProvider extends NetworkElement, IpDeployingRequester {
|
||||
|
||||
static String getPublicPortRange(PortForwardingRule rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePFPortRange(PortForwardingRule rule) {
|
||||
return rule.getDestinationPortStart() == rule.getDestinationPortEnd() ?
|
||||
String.valueOf(rule.getDestinationPortStart()) :
|
||||
String.valueOf(rule.getDestinationPortStart()).concat("-").concat(String.valueOf(rule.getDestinationPortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePortRange(FirewallRule rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
static String getPrivatePortRangeForACLRule(NetworkACLItem rule) {
|
||||
return Objects.equals(rule.getSourcePortStart(), rule.getSourcePortEnd()) ?
|
||||
String.valueOf(rule.getSourcePortStart()) :
|
||||
String.valueOf(rule.getSourcePortStart()).concat("-").concat(String.valueOf(rule.getSourcePortEnd()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply rules
|
||||
* @param network
|
||||
|
|
|
|||
|
|
@ -55,4 +55,6 @@ public interface VpcProvider extends NetworkElement {
|
|||
boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException;
|
||||
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
|
||||
boolean updateVpc(Vpc vpc, String previousVpcName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,4 +215,8 @@ public interface NetworkGuru extends Adapter {
|
|||
default boolean isSlaacV6Only() {
|
||||
return true;
|
||||
}
|
||||
|
||||
default boolean update(Network network, String prevNetworkName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
// 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 com.cloud.network.netris;
|
||||
|
||||
public class NetrisLbBackend {
|
||||
private long vmId;
|
||||
private String vmIp;
|
||||
private int port;
|
||||
|
||||
public NetrisLbBackend(long vmId, String vmIp, int port) {
|
||||
this.vmId = vmId;
|
||||
this.vmIp = vmIp;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public long getVmId() {
|
||||
return vmId;
|
||||
}
|
||||
|
||||
public String getVmIp() {
|
||||
return vmIp;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
// 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 com.cloud.network.netris;
|
||||
|
||||
import com.cloud.network.SDNProviderNetworkRule;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NetrisNetworkRule {
|
||||
public enum NetrisRuleAction {
|
||||
PERMIT, DENY
|
||||
}
|
||||
|
||||
private SDNProviderNetworkRule baseRule;
|
||||
private NetrisRuleAction aclAction;
|
||||
private List<NetrisLbBackend> lbBackends;
|
||||
private String lbRuleName;
|
||||
private String lbCidrList;
|
||||
private String reason;
|
||||
|
||||
public NetrisNetworkRule(Builder builder) {
|
||||
this.baseRule = builder.baseRule;
|
||||
this.aclAction = builder.aclAction;
|
||||
this.lbBackends = builder.lbBackends;
|
||||
this.reason = builder.reason;
|
||||
this.lbCidrList = builder.lbCidrList;
|
||||
this.lbRuleName = builder.lbRuleName;
|
||||
}
|
||||
|
||||
public NetrisRuleAction getAclAction() {
|
||||
return aclAction;
|
||||
}
|
||||
|
||||
public List<NetrisLbBackend> getLbBackends() {
|
||||
return lbBackends;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public String getLbCidrList() {return lbCidrList; }
|
||||
|
||||
public String getLbRuleName() { return lbRuleName; }
|
||||
|
||||
public SDNProviderNetworkRule getBaseRule() {
|
||||
return baseRule;
|
||||
}
|
||||
|
||||
// Builder class extending the parent builder
|
||||
public static class Builder {
|
||||
private SDNProviderNetworkRule baseRule;
|
||||
private NetrisRuleAction aclAction;
|
||||
private List<NetrisLbBackend> lbBackends;
|
||||
private String reason;
|
||||
private String lbCidrList;
|
||||
private String lbRuleName;
|
||||
|
||||
public Builder baseRule(SDNProviderNetworkRule baseRule) {
|
||||
this.baseRule = baseRule;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder aclAction(NetrisRuleAction aclAction) {
|
||||
this.aclAction = aclAction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbBackends(List<NetrisLbBackend> lbBackends) {
|
||||
this.lbBackends = lbBackends;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder reason(String reason) {
|
||||
this.reason = reason;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbCidrList(String lbCidrList) {
|
||||
this.lbCidrList = lbCidrList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder lbRuleName(String lbRuleName) {
|
||||
this.lbRuleName = lbRuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetrisNetworkRule build() {
|
||||
return new NetrisNetworkRule(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
// 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 com.cloud.network.netris;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface NetrisProvider extends InternalIdentity, Identity {
|
||||
long getZoneId();
|
||||
String getName();
|
||||
String getUrl();
|
||||
String getUsername();
|
||||
String getSiteName();
|
||||
String getTenantName();
|
||||
String getNetrisTag();
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// 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 com.cloud.network.netris;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.SDNProviderNetworkRule;
|
||||
import com.cloud.network.vpc.StaticRoute;
|
||||
import com.cloud.network.vpc.Vpc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NetrisService {
|
||||
boolean createIPAMAllocationsForZoneLevelPublicRanges(long zoneId);
|
||||
|
||||
boolean createVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, boolean sourceNatEnabled, String cidr, boolean isVpcNetwork);
|
||||
|
||||
boolean updateVpcResource(long zoneId, long accountId, long domainId, Long vpcId, String vpcName, String previousVpcName);
|
||||
|
||||
boolean deleteVpcResource(long zoneId, long accountId, long domainId, Vpc vpc);
|
||||
|
||||
boolean createVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr, Boolean globalRouting);
|
||||
|
||||
boolean updateVnetResource(Long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String prevNetworkName);
|
||||
|
||||
boolean deleteVnetResource(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, String cidr);
|
||||
|
||||
boolean createSnatRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, long networkId, boolean isForVpc, String vpcCidr, String sourceNatIp);
|
||||
|
||||
boolean createPortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
|
||||
|
||||
boolean deletePortForwardingRule(long zoneId, long accountId, long domainId, String vpcName, Long vpcId, String networkName, Long networkId, boolean isForVpc, String vpcCidr, SDNProviderNetworkRule networkRule);
|
||||
|
||||
boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address);
|
||||
|
||||
boolean createStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String vpcCidr, String staticNatIp, String vmIp, long vmId);
|
||||
|
||||
boolean deleteStaticNatRule(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String staticNatIp, long vmId);
|
||||
|
||||
boolean addFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
|
||||
boolean deleteFirewallRules(Network network, List<NetrisNetworkRule> firewallRules);
|
||||
|
||||
boolean addOrUpdateStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId, boolean updateRoute);
|
||||
|
||||
boolean deleteStaticRoute(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
|
||||
|
||||
List<StaticRoute> listStaticRoutes(long zoneId, long accountId, long domainId, String networkResourceName, Long networkResourceId, boolean isForVpc, String prefix, String nextHop, Long routeId);
|
||||
|
||||
boolean releaseNatIp(long zoneId, String publicIp);
|
||||
|
||||
boolean createOrUpdateLbRule(NetrisNetworkRule rule);
|
||||
boolean deleteLbRule(NetrisNetworkRule rule);
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
|
|||
Staged, // route been created but has never got through network rule conflict detection. Routes in this state can not be sent to VPC virtual router.
|
||||
Add, // Add means the route has been created and has gone through network rule conflict detection.
|
||||
Active, // Route has been sent to the VPC router and reported to be active.
|
||||
Update,
|
||||
Revoke, // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database.
|
||||
Deleting // rule has been revoked and is scheduled for deletion
|
||||
}
|
||||
|
|
@ -32,7 +33,9 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
long getVpcGatewayId();
|
||||
Long getVpcGatewayId();
|
||||
|
||||
String getNextHop();
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
private String targetCidr;
|
||||
private long accountId;
|
||||
private long domainId;
|
||||
private long gatewayId;
|
||||
private Long gatewayId;
|
||||
private String nextHop;
|
||||
private StaticRoute.State state;
|
||||
private long vpcId;
|
||||
String vlanTag;
|
||||
|
|
@ -46,6 +47,18 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
ipAddress = gateway.getIp4Address();
|
||||
}
|
||||
|
||||
public StaticRouteProfile(StaticRoute staticRoute) {
|
||||
id = staticRoute.getId();
|
||||
uuid = staticRoute.getUuid();
|
||||
targetCidr = staticRoute.getCidr();
|
||||
accountId = staticRoute.getAccountId();
|
||||
domainId = staticRoute.getDomainId();
|
||||
gatewayId = staticRoute.getVpcGatewayId();
|
||||
state = staticRoute.getState();
|
||||
vpcId = staticRoute.getVpcId();
|
||||
gateway = staticRoute.getNextHop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAccountId() {
|
||||
return accountId;
|
||||
|
|
@ -57,10 +70,15 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getVpcGatewayId() {
|
||||
public Long getVpcGatewayId() {
|
||||
return gatewayId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNextHop() {
|
||||
return nextHop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCidr() {
|
||||
return targetCidr;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
public static final String redundantVPCOfferingName = "Redundant VPC offering";
|
||||
public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode";
|
||||
public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode";
|
||||
public static final String DEFAULT_VPC_ROUTE_NETRIS_OFFERING_NAME = "VPC offering with Netris - Route Mode";
|
||||
public static final String DEFAULT_VPC_NAT_NETRIS_OFFERING_NAME = "VPC offering with Netris - NAT Mode";
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -56,8 +58,6 @@ public interface VpcOffering extends InternalIdentity, Identity {
|
|||
*/
|
||||
boolean isDefault();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
NetworkOffering.NetworkMode getNetworkMode();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public interface VpcProvisioningService {
|
|||
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
|
||||
Map<String, List<String>> serviceProviders,
|
||||
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
|
||||
Long serviceOfferingId, Boolean forNsx, NetworkOffering.NetworkMode networkMode,
|
||||
Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode,
|
||||
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state,
|
||||
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ public interface VpcService {
|
|||
* @param cidr
|
||||
* @return
|
||||
*/
|
||||
StaticRoute createStaticRoute(long gatewayId, String cidr) throws NetworkRuleConflictException;
|
||||
StaticRoute createStaticRoute(Long gatewayId, Long vpcId, String nextHop, String cidr) throws NetworkRuleConflictException;
|
||||
|
||||
/**
|
||||
* Lists static routes based on parameters passed to the call
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC = "DefaultNATNSXNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NSX_OFFERING_FOR_VPC_WITH_ILB = "DefaultNATNSXNetworkOfferingForVpcWithInternalLB";
|
||||
public static final String DEFAULT_ROUTED_NSX_OFFERING_FOR_VPC = "DefaultRoutedNSXNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_ROUTED_NETRIS_OFFERING_FOR_VPC = "DefaultRoutedNetrisNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NETRIS_OFFERING_FOR_VPC = "DefaultNATNetrisNetworkOfferingForVpc";
|
||||
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
|
||||
public static final String DEFAULT_ROUTED_NSX_OFFERING = "DefaultRoutedNSXNetworkOffering";
|
||||
public final static String QuickCloudNoServices = "QuickCloudNoServices";
|
||||
|
|
@ -102,10 +104,6 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
|
|||
|
||||
boolean isForVpc();
|
||||
|
||||
boolean isForTungsten();
|
||||
|
||||
boolean isForNsx();
|
||||
|
||||
NetworkMode getNetworkMode();
|
||||
|
||||
TrafficType getTrafficType();
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ public class ApiConstants {
|
|||
public static final String FORMAT = "format";
|
||||
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
|
||||
public static final String FOR_SYSTEM_VMS = "forsystemvms";
|
||||
public static final String FOR_PROVIDER = "forprovider";
|
||||
public static final String FULL_PATH = "fullpath";
|
||||
public static final String GATEWAY = "gateway";
|
||||
public static final String IP6_GATEWAY = "ip6gateway";
|
||||
|
|
@ -253,6 +254,7 @@ public class ApiConstants {
|
|||
public static final String PREVIOUS_OWNER_ID = "previousownerid";
|
||||
public static final String PREVIOUS_OWNER_NAME = "previousownername";
|
||||
public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
|
||||
public static final String NEXT_HOP = "nexthop";
|
||||
public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash";
|
||||
public static final String IMAGE_PATH = "imagepath";
|
||||
public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported";
|
||||
|
|
@ -325,6 +327,8 @@ public class ApiConstants {
|
|||
public static final String MIN_CPU_NUMBER = "mincpunumber";
|
||||
public static final String MIN_MEMORY = "minmemory";
|
||||
public static final String MIGRATION_TYPE = "migrationtype";
|
||||
public static final String MIGRATION_JOB_ID = "migrationjobid";
|
||||
public static final String MIGRATION_JOB_STATUS = "migrationjobstatus";
|
||||
public static final String MIGRATIONS = "migrations";
|
||||
public static final String MEMORY = "memory";
|
||||
public static final String MODE = "mode";
|
||||
|
|
@ -448,6 +452,7 @@ public class ApiConstants {
|
|||
public static final String SIGNATURE = "signature";
|
||||
public static final String SIGNATURE_VERSION = "signatureversion";
|
||||
public static final String SINCE = "since";
|
||||
public static final String SITE_NAME = "sitename";
|
||||
public static final String SIZE = "size";
|
||||
public static final String SIZEGB = "sizegb";
|
||||
public static final String SNAPSHOT = "snapshot";
|
||||
|
|
@ -490,6 +495,7 @@ public class ApiConstants {
|
|||
public static final String TIMEOUT = "timeout";
|
||||
public static final String TIMEZONE = "timezone";
|
||||
public static final String TIMEZONEOFFSET = "timezoneoffset";
|
||||
public static final String TENANT_NAME = "tenantname";
|
||||
public static final String TOTAL = "total";
|
||||
public static final String TOTAL_SUBNETS = "totalsubnets";
|
||||
public static final String TYPE = "type";
|
||||
|
|
@ -858,6 +864,8 @@ public class ApiConstants {
|
|||
public static final String NETWORK = "network";
|
||||
public static final String VPC_ID = "vpcid";
|
||||
public static final String VPC_NAME = "vpcname";
|
||||
public static final String VPC_GATEWAY_ID = "vpcgatewayid";
|
||||
public static final String VPC_GATEWAY_IP = "vpcgatewayip";
|
||||
public static final String GATEWAY_ID = "gatewayid";
|
||||
public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
|
||||
public static final String RESOURCE_IDS = "resourceids";
|
||||
|
|
@ -1143,6 +1151,9 @@ public class ApiConstants {
|
|||
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
|
||||
public static final String HAS_RULES = "hasrules";
|
||||
public static final String NSX_DETAIL_KEY = "forNsx";
|
||||
public static final String NETRIS_DETAIL_KEY = "forNetris";
|
||||
public static final String NETRIS_TAG = "netristag";
|
||||
public static final String NETRIS_VXLAN_ID = "netrisvxlanid";
|
||||
public static final String DISK_PATH = "diskpath";
|
||||
public static final String IMPORT_SOURCE = "importsource";
|
||||
public static final String TEMP_PATH = "temppath";
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.cloudstack.api.command.admin.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -140,12 +141,19 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
description = "true if network offering is meant to be used for VPC, false otherwise.")
|
||||
private Boolean forVpc;
|
||||
|
||||
@Deprecated
|
||||
@Parameter(name = ApiConstants.FOR_NSX,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering is meant to be used for NSX, false otherwise.",
|
||||
since = "4.20.0")
|
||||
private Boolean forNsx;
|
||||
|
||||
@Parameter(name = ApiConstants.PROVIDER,
|
||||
type = CommandType.STRING,
|
||||
description = "Name of the provider providing the service",
|
||||
since = "4.20.0")
|
||||
private String provider;
|
||||
|
||||
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering for NSX network offering supports Load balancer service.",
|
||||
|
|
@ -257,18 +265,38 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
return serviceOfferingId;
|
||||
}
|
||||
|
||||
public boolean isExternalNetworkProvider() {
|
||||
return Arrays.asList("NSX", "Netris").stream()
|
||||
.anyMatch(s -> provider != null && s.equalsIgnoreCase(provider));
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return provider != null && provider.equalsIgnoreCase("NSX");
|
||||
}
|
||||
|
||||
public boolean isForNetris() {
|
||||
return provider != null && provider.equalsIgnoreCase("Netris");
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public List<String> getSupportedServices() {
|
||||
if (!isForNsx()) {
|
||||
if (!isExternalNetworkProvider()) {
|
||||
return supportedServices == null ? new ArrayList<String>() : supportedServices;
|
||||
} else {
|
||||
List<String> services = new ArrayList<>(List.of(
|
||||
Dhcp.getName(),
|
||||
Dns.getName(),
|
||||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
PortForwarding.getName(),
|
||||
UserData.getName()
|
||||
));
|
||||
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
|
||||
services.addAll(Arrays.asList(
|
||||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
PortForwarding.getName()));
|
||||
}
|
||||
if (getNsxSupportsLbService()) {
|
||||
services.add(Lb.getName());
|
||||
}
|
||||
|
|
@ -308,10 +336,6 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
return forVpc;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return BooleanUtils.isTrue(forNsx);
|
||||
}
|
||||
|
||||
public String getNetworkMode() {
|
||||
return networkMode;
|
||||
}
|
||||
|
|
@ -345,7 +369,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
|
||||
public Map<String, List<String>> getServiceProviders() {
|
||||
Map<String, List<String>> serviceProviderMap = new HashMap<>();
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) {
|
||||
Collection servicesCollection = serviceProviderList.values();
|
||||
Iterator iter = servicesCollection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
|
@ -361,17 +385,16 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
providerList.add(provider);
|
||||
serviceProviderMap.put(service, providerList);
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(forNsx)) {
|
||||
getServiceProviderMapForNsx(serviceProviderMap);
|
||||
} else if (isExternalNetworkProvider()) {
|
||||
getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName());
|
||||
}
|
||||
return serviceProviderMap;
|
||||
}
|
||||
|
||||
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
|
||||
private void getServiceProviderMapForExternalProvider(Map<String, List<String>> serviceProviderMap, String provider) {
|
||||
String routerProvider = Boolean.TRUE.equals(getForVpc()) ? VirtualRouterProvider.Type.VPCVirtualRouter.name() :
|
||||
VirtualRouterProvider.Type.VirtualRouter.name();
|
||||
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "SecurityGroup", "Connectivity",
|
||||
"Gateway", "BaremetalPxeService"));
|
||||
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "Gateway", "SecurityGroup", "Connectivity", "BaremetalPxeService"));
|
||||
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
|
||||
List<String> allServices = Service.listAllServices().stream().map(Service::getName).collect(Collectors.toList());
|
||||
if (routerProvider.equals(VirtualRouterProvider.Type.VPCVirtualRouter.name())) {
|
||||
|
|
@ -384,8 +407,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
|
|||
continue;
|
||||
if (routerSupported.contains(service))
|
||||
serviceProviderMap.put(service, List.of(routerProvider));
|
||||
else
|
||||
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
|
||||
else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) || NetworkACL.getName().equalsIgnoreCase(service)) {
|
||||
serviceProviderMap.put(service, List.of(provider));
|
||||
}
|
||||
if (!getNsxSupportsLbService()) {
|
||||
serviceProviderMap.remove(Lb.getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.vlan;
|
||||
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
|
|
@ -39,7 +41,6 @@ import com.cloud.exception.ResourceAllocationException;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
|
|
@ -114,8 +115,8 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if the IP range is used for NSX resource", since = "4.20.0")
|
||||
private boolean forNsx;
|
||||
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "Provider name for which the IP range is reserved for", since = "4.20.0")
|
||||
private String provider;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -157,12 +158,12 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
|||
return startIp;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return !Objects.isNull(forNsx) && forNsx;
|
||||
public Network.Provider getProvider() {
|
||||
return Network.Provider.getProvider(provider);
|
||||
}
|
||||
|
||||
public String getVlan() {
|
||||
if ((vlan == null || vlan.isEmpty()) && !isForNsx()) {
|
||||
if ((vlan == null || vlan.isEmpty()) && !ConfigurationService.IsIpRangeForProvider(getProvider())) {
|
||||
vlan = "untagged";
|
||||
}
|
||||
return vlan;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.cloudstack.api.command.admin.vpc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -25,10 +26,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.VirtualRouterProvider;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
|
@ -57,6 +60,7 @@ import static com.cloud.network.Network.Service.SourceNat;
|
|||
import static com.cloud.network.Network.Service.PortForwarding;
|
||||
import static com.cloud.network.Network.Service.NetworkACL;
|
||||
import static com.cloud.network.Network.Service.UserData;
|
||||
import static com.cloud.network.Network.Service.Gateway;
|
||||
|
||||
@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
|
|
@ -112,12 +116,19 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
since = "4.13")
|
||||
private List<Long> zoneIds;
|
||||
|
||||
@Deprecated
|
||||
@Parameter(name = ApiConstants.FOR_NSX,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering is meant to be used for NSX, false otherwise.",
|
||||
since = "4.20.0")
|
||||
private Boolean forNsx;
|
||||
|
||||
@Parameter(name = ApiConstants.PROVIDER,
|
||||
type = CommandType.STRING,
|
||||
description = "Name of the provider providing the service",
|
||||
since = "4.20.0")
|
||||
private String provider;
|
||||
|
||||
@Parameter(name = ApiConstants.NSX_SUPPORT_LB,
|
||||
type = CommandType.BOOLEAN,
|
||||
description = "true if network offering for NSX VPC offering supports Load balancer service.",
|
||||
|
|
@ -158,20 +169,31 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
return StringUtils.isEmpty(displayText) ? vpcOfferingName : displayText;
|
||||
}
|
||||
|
||||
public boolean isExternalNetworkProvider() {
|
||||
return Arrays.asList("NSX", "Netris").stream()
|
||||
.anyMatch(s -> provider != null && s.equalsIgnoreCase(provider));
|
||||
}
|
||||
|
||||
public List<String> getSupportedServices() {
|
||||
if (!isForNsx() && CollectionUtils.isEmpty(supportedServices)) {
|
||||
if (!isExternalNetworkProvider() && CollectionUtils.isEmpty(supportedServices)) {
|
||||
throw new InvalidParameterValueException("Supported services needs to be provided");
|
||||
}
|
||||
if (isForNsx()) {
|
||||
if (isExternalNetworkProvider()) {
|
||||
supportedServices = new ArrayList<>(List.of(
|
||||
Dhcp.getName(),
|
||||
Dns.getName(),
|
||||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
NetworkACL.getName(),
|
||||
PortForwarding.getName(),
|
||||
UserData.getName()
|
||||
));
|
||||
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
|
||||
supportedServices.addAll(Arrays.asList(
|
||||
StaticNat.getName(),
|
||||
SourceNat.getName(),
|
||||
PortForwarding.getName()));
|
||||
}
|
||||
if (NetworkOffering.NetworkMode.ROUTED.name().equalsIgnoreCase(getNetworkMode())) {
|
||||
supportedServices.add(Gateway.getName());
|
||||
}
|
||||
if (getNsxSupportsLbService()) {
|
||||
supportedServices.add(Lb.getName());
|
||||
}
|
||||
|
|
@ -179,8 +201,8 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
return supportedServices;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return BooleanUtils.isTrue(forNsx);
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public String getNetworkMode() {
|
||||
|
|
@ -193,7 +215,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
public Map<String, List<String>> getServiceProviders() {
|
||||
Map<String, List<String>> serviceProviderMap = new HashMap<>();
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
|
||||
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isExternalNetworkProvider()) {
|
||||
Collection<? extends Map<String, String>> servicesCollection = serviceProviderList.values();
|
||||
Iterator<? extends Map<String, String>> iter = servicesCollection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
|
@ -213,16 +235,18 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
providerList.add(provider);
|
||||
serviceProviderMap.put(service, providerList);
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(forNsx)) {
|
||||
getServiceProviderMapForNsx(serviceProviderMap);
|
||||
} else if (isExternalNetworkProvider()) {
|
||||
getServiceProviderMapForExternalProvider(serviceProviderMap, Network.Provider.getProvider(provider).getName());
|
||||
}
|
||||
|
||||
return serviceProviderMap;
|
||||
}
|
||||
|
||||
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
|
||||
List<String> unsupportedServices = List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity",
|
||||
"Gateway", "Firewall");
|
||||
private void getServiceProviderMapForExternalProvider(Map<String, List<String>> serviceProviderMap, String provider) {
|
||||
List<String> unsupportedServices = new ArrayList<>(List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity", "Firewall"));
|
||||
if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode())) {
|
||||
unsupportedServices.add("Gateway");
|
||||
}
|
||||
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
|
||||
List<String> allServices = Network.Service.listAllServices().stream().map(Network.Service::getName).collect(Collectors.toList());
|
||||
for (String service : allServices) {
|
||||
|
|
@ -230,8 +254,10 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
|
|||
continue;
|
||||
if (routerSupported.contains(service))
|
||||
serviceProviderMap.put(service, List.of(VirtualRouterProvider.Type.VPCVirtualRouter.name()));
|
||||
else
|
||||
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
|
||||
else if (NetworkOffering.NetworkMode.NATTED.name().equalsIgnoreCase(getNetworkMode()) ||
|
||||
Stream.of(NetworkACL.getName(), Gateway.getName()).anyMatch(s -> s.equalsIgnoreCase(service))) {
|
||||
serviceProviderMap.put(service, List.of(provider));
|
||||
}
|
||||
}
|
||||
if (!getNsxSupportsLbService()) {
|
||||
serviceProviderMap.remove(Lb.getName());
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC
|
|||
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if range is dedicated for system VMs", since = "4.20.0")
|
||||
private Boolean forSystemVMs;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_PROVIDER, type = CommandType.BOOLEAN, description = "true if range is dedicated for external network provider", since = "4.20.0")
|
||||
private Boolean forProvider;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -183,6 +186,10 @@ public class ListPublicIpAddressesCmd extends BaseListRetrieveOnlyResourceCountC
|
|||
return BooleanUtils.isTrue(forSystemVMs);
|
||||
}
|
||||
|
||||
public boolean isForProvider() {
|
||||
return BooleanUtils.isTrue(forProvider);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.StaticRouteResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
|
|
@ -45,20 +46,38 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
|
|||
@Parameter(name = ApiConstants.GATEWAY_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = PrivateGatewayResponse.class,
|
||||
required = true,
|
||||
description = "the gateway id we are creating static route for")
|
||||
description = "the gateway id we are creating static route for. Mutually exclusive with the nexthop parameter")
|
||||
private Long gatewayId;
|
||||
|
||||
@Parameter(name = ApiConstants.VPC_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = VpcResponse.class,
|
||||
description = "the vpc id for which the static route is created. This is required for nexthop parameter")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name = ApiConstants.NEXT_HOP,
|
||||
type = CommandType.STRING,
|
||||
description = "the next hop of static route. Mutually exclusive with the gatewayid parameter")
|
||||
private String nextHop;
|
||||
|
||||
@Parameter(name = ApiConstants.CIDR, required = true, type = CommandType.STRING, description = "static route cidr")
|
||||
private String cidr;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
public long getGatewayId() {
|
||||
public Long getGatewayId() {
|
||||
return gatewayId;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public String getNextHop() {
|
||||
return nextHop;
|
||||
}
|
||||
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
|
|
@ -69,7 +88,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
|
|||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
try {
|
||||
StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getCidr());
|
||||
StaticRoute result = _vpcService.createStaticRoute(getGatewayId(), getVpcId(), getNextHop(), getCidr());
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
} catch (NetworkRuleConflictException ex) {
|
||||
|
|
@ -114,11 +133,8 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
|
||||
if (gateway == null) {
|
||||
throw new InvalidParameterValueException("Invalid gateway id is specified");
|
||||
}
|
||||
return _entityMgr.findById(Vpc.class, gateway.getVpcId()).getAccountId();
|
||||
Long vpcId = getSyncObjId();
|
||||
return _entityMgr.findById(Vpc.class, vpcId).getAccountId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -128,11 +144,20 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
|
||||
if (gateway == null) {
|
||||
throw new InvalidParameterValueException("Invalid id is specified for the gateway");
|
||||
if (gatewayId != null) {
|
||||
VpcGateway gateway = _entityMgr.findById(VpcGateway.class, gatewayId);
|
||||
if (gateway == null) {
|
||||
throw new InvalidParameterValueException("Invalid id is specified for the gateway");
|
||||
}
|
||||
return gateway.getVpcId();
|
||||
} else if (vpcId != null) {
|
||||
Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException("Invalid vpc id is specified");
|
||||
}
|
||||
return vpc.getId();
|
||||
}
|
||||
return gateway.getVpcId();
|
||||
throw new InvalidParameterValueException("One of vpcId or gatewayId must be specified");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.apache.cloudstack.api.BaseAsyncCmd;
|
|||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.IPAddressResponse;
|
||||
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
|
@ -44,9 +45,15 @@ public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd {
|
|||
type = CommandType.UUID,
|
||||
entityType = VpcResponse.class,
|
||||
required = true,
|
||||
description = "public ip address id of the vpn gateway")
|
||||
description = "id of the vpc")
|
||||
private Long vpcId;
|
||||
|
||||
@Parameter(name = ApiConstants.IP_ADDRESS_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = IPAddressResponse.class,
|
||||
description = "the public IP address ID for which VPN gateway is being enabled. By default the source NAT IP or router IP will be used.")
|
||||
private Long ipAddressId;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpn to the end user or not", since = "4.4", authorized = {RoleType.Admin})
|
||||
private Boolean display;
|
||||
|
||||
|
|
@ -58,6 +65,10 @@ public class CreateVpnGatewayCmd extends BaseAsyncCreateCmd {
|
|||
return vpcId;
|
||||
}
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return ipAddressId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Boolean getDisplay() {
|
||||
return display;
|
||||
|
|
|
|||
|
|
@ -55,10 +55,6 @@ public class AsyncJobResponse extends BaseResponse {
|
|||
@Param(description = "the async command executed")
|
||||
private String cmd;
|
||||
|
||||
@SerializedName("jobstatus")
|
||||
@Param(description = "the current job status-should be 0 for PENDING")
|
||||
private Integer jobStatus;
|
||||
|
||||
@SerializedName("jobprocstatus")
|
||||
@Param(description = "the progress information of the PENDING job")
|
||||
private Integer jobProcStatus;
|
||||
|
|
@ -119,11 +115,6 @@ public class AsyncJobResponse extends BaseResponse {
|
|||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJobStatus(Integer jobStatus) {
|
||||
this.jobStatus = jobStatus;
|
||||
}
|
||||
|
||||
public void setJobProcStatus(Integer jobProcStatus) {
|
||||
this.jobProcStatus = jobProcStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ public class ClusterDrsPlanMigrationResponse extends BaseResponse {
|
|||
@Param(description = "Destination host for VM migration")
|
||||
String destHostName;
|
||||
|
||||
@SerializedName(ApiConstants.JOB_ID)
|
||||
@SerializedName(ApiConstants.MIGRATION_JOB_ID)
|
||||
@Param(description = "id of VM migration async job")
|
||||
private Long jobId;
|
||||
private Long migrationJobId;
|
||||
|
||||
@SerializedName(ApiConstants.JOB_STATUS)
|
||||
@SerializedName(ApiConstants.MIGRATION_JOB_STATUS)
|
||||
@Param(description = "Job status of VM migration async job")
|
||||
private JobInfo.Status jobStatus;
|
||||
private JobInfo.Status migrationJobStatus;
|
||||
|
||||
|
||||
public ClusterDrsPlanMigrationResponse(String vmId, String vmName, String srcHostId, String srcHostName,
|
||||
|
|
@ -68,8 +68,8 @@ public class ClusterDrsPlanMigrationResponse extends BaseResponse {
|
|||
this.srcHostName = srcHostName;
|
||||
this.destHostId = destHostId;
|
||||
this.destHostName = destHostName;
|
||||
this.jobId = jobId;
|
||||
this.jobStatus = jobStatus;
|
||||
this.migrationJobId = jobId;
|
||||
this.migrationJobStatus = jobStatus;
|
||||
this.setObjectName(ApiConstants.MIGRATIONS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,6 +175,10 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
|
|||
@Param(description="true if range is dedicated for System VMs")
|
||||
private boolean forSystemVms;
|
||||
|
||||
@SerializedName(ApiConstants.FOR_PROVIDER)
|
||||
@Param(description="true if range is dedicated for external network providers")
|
||||
private boolean forProvider;
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
|
@ -332,4 +336,6 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
|
|||
public void setForSystemVms(boolean forSystemVms) {
|
||||
this.forSystemVms = forSystemVms;
|
||||
}
|
||||
|
||||
public void setForProvider(boolean forProvider) { this.forProvider = forProvider; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,14 +208,6 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
|
|||
@Param(description = "Name of the VPC to which this network belongs", since = "4.15")
|
||||
private String vpcName;
|
||||
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID)
|
||||
@Param(description = "the ID of the Network associated with this network")
|
||||
private String associatedNetworkId;
|
||||
|
||||
@SerializedName(ApiConstants.ASSOCIATED_NETWORK)
|
||||
@Param(description = "the name of the Network associated with this network")
|
||||
private String associatedNetworkName;
|
||||
|
||||
@SerializedName(ApiConstants.TUNGSTEN_VIRTUAL_ROUTER_UUID)
|
||||
@Param(description = "Tungsten-Fabric virtual router the network belongs to")
|
||||
private String tungstenVirtualRouterUuid;
|
||||
|
|
@ -612,14 +604,6 @@ public class NetworkResponse extends BaseResponseWithAssociatedNetwork implement
|
|||
this.vpcName = vpcName;
|
||||
}
|
||||
|
||||
public void setAssociatedNetworkId(String associatedNetworkId) {
|
||||
this.associatedNetworkId = associatedNetworkId;
|
||||
}
|
||||
|
||||
public void setAssociatedNetworkName(String associatedNetworkName) {
|
||||
this.associatedNetworkName = associatedNetworkName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceIconResponse(ResourceIconResponse icon) {
|
||||
this.icon = icon;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,17 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
|
|||
@Param(description = "VPC the static route belongs to")
|
||||
private String vpcId;
|
||||
|
||||
@SerializedName(ApiConstants.GATEWAY_ID)
|
||||
@SerializedName(ApiConstants.VPC_GATEWAY_ID)
|
||||
@Param(description = "VPC gateway the route is created for")
|
||||
private String gatewayId;
|
||||
private String vpcGatewayId;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_GATEWAY_IP)
|
||||
@Param(description = "IP of VPC gateway the route is created for")
|
||||
private String vpcGatewayIp;
|
||||
|
||||
@SerializedName(ApiConstants.NEXT_HOP)
|
||||
@Param(description = "Next hop of the static route")
|
||||
private String nextHop;
|
||||
|
||||
@SerializedName(ApiConstants.CIDR)
|
||||
@Param(description = "static route CIDR")
|
||||
|
|
@ -95,8 +103,16 @@ public class StaticRouteResponse extends BaseResponse implements ControlledEntit
|
|||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
public void setGatewayId(String gatewayId) {
|
||||
this.gatewayId = gatewayId;
|
||||
public void setVpcGatewayId(String vpcGatewayId) {
|
||||
this.vpcGatewayId = vpcGatewayId;
|
||||
}
|
||||
|
||||
public void setVpcGatewayIp(String vpcGatewayIp) {
|
||||
this.vpcGatewayIp = vpcGatewayIp;
|
||||
}
|
||||
|
||||
public void setNextHop(String nextHop) {
|
||||
this.nextHop = nextHop;
|
||||
}
|
||||
|
||||
public void setCidr(String cidr) {
|
||||
|
|
|
|||
|
|
@ -38,14 +38,6 @@ public class SystemVmResponse extends BaseResponseWithAnnotations {
|
|||
@Param(description = "the system VM type")
|
||||
private String systemVmType;
|
||||
|
||||
@SerializedName("jobid")
|
||||
@Param(description = "the job ID associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
|
||||
private String jobId;
|
||||
|
||||
@SerializedName("jobstatus")
|
||||
@Param(description = "the job status associated with the system VM. This is only displayed if the router listed is part of a currently running asynchronous job.")
|
||||
private Integer jobStatus;
|
||||
|
||||
@SerializedName("zoneid")
|
||||
@Param(description = "the Zone ID for the system VM")
|
||||
private String zoneId;
|
||||
|
|
|
|||
|
|
@ -127,9 +127,9 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
|||
@Param(description = "indicates whether VLAN IP range is dedicated to system vms or not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@SerializedName(ApiConstants.FOR_NSX)
|
||||
@Param(description = "indicates whether IP range is dedicated to NSX resources or not")
|
||||
private Boolean forNsx;
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "indicates whether IP range is dedicated to NSX resources or not", since = "4.20.0")
|
||||
private String provider;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
|
|
@ -249,7 +249,7 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
|||
this.ip6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
public void setForNsx(Boolean forNsx) {
|
||||
this.forNsx = forNsx;
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,10 +145,15 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
|
|||
@Param(description = "the type of the zone - core or edge", since = "4.18.0")
|
||||
String type;
|
||||
|
||||
@Deprecated(since = "4.20")
|
||||
@SerializedName(ApiConstants.NSX_ENABLED)
|
||||
@Param(description = "true, if zone is NSX enabled", since = "4.20.0")
|
||||
private boolean nsxEnabled = false;
|
||||
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "External network provider if any", since = "4.20.0")
|
||||
private String provider = null;
|
||||
|
||||
@SerializedName(ApiConstants.MULTI_ARCH)
|
||||
@Param(description = "true, if zone contains clusters and hosts from different CPU architectures", since = "4.20")
|
||||
private boolean multiArch;
|
||||
|
|
@ -368,6 +373,14 @@ public class ZoneResponse extends BaseResponseWithAnnotations implements SetReso
|
|||
return nsxEnabled;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceIconResponse(ResourceIconResponse resourceIconResponse) {
|
||||
this.resourceIconResponse = resourceIconResponse;
|
||||
|
|
|
|||
|
|
@ -1097,6 +1097,11 @@
|
|||
<artifactId>cloud-plugin-network-nsx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-netris</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-tungsten</artifactId>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import java.util.Map;
|
|||
public class CheckS2SVpnConnectionsAnswer extends Answer {
|
||||
Map<String, Boolean> ipToConnected;
|
||||
Map<String, String> ipToDetail;
|
||||
String details;
|
||||
|
||||
protected CheckS2SVpnConnectionsAnswer() {
|
||||
ipToConnected = new HashMap<String, Boolean>();
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
|
|||
String routerIpv6Gateway = null;
|
||||
String routerIpv6Cidr = null;
|
||||
boolean isVrGuestGateway = false;
|
||||
long networkId;
|
||||
|
||||
public NicTO getNic() {
|
||||
return nic;
|
||||
|
|
@ -123,4 +124,12 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
|
|||
public void setVrGuestGateway(boolean vrGuestGateway) {
|
||||
isVrGuestGateway = vrGuestGateway;
|
||||
}
|
||||
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public void setNetworkId(long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class SetGuestNetworkConfigItem extends AbstractConfigItemFacade {
|
|||
guestNetwork.setRouterIp6Gateway(command.getRouterIpv6Gateway());
|
||||
guestNetwork.setRouterIp6Cidr(command.getRouterIpv6Cidr());
|
||||
guestNetwork.setVrGuestGateway(command.isVrGuestGateway());
|
||||
guestNetwork.setNetworkId(command.getNetworkId());
|
||||
|
||||
return generateConfigItems(guestNetwork);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class GuestNetwork extends ConfigBase {
|
|||
private String routerIp6Gateway;
|
||||
private String routerIp6Cidr;
|
||||
private boolean isVrGuestGateway;
|
||||
long networkId;
|
||||
|
||||
private Integer mtu;
|
||||
|
||||
|
|
@ -211,4 +212,12 @@ public class GuestNetwork extends ConfigBase {
|
|||
public void setVrGuestGateway(boolean vrGuestGateway) {
|
||||
isVrGuestGateway = vrGuestGateway;
|
||||
}
|
||||
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public void setNetworkId(long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,13 +75,17 @@ public class ArrayTypeAdaptor<T> implements JsonDeserializer<T[]>, JsonSerialize
|
|||
try {
|
||||
clazz = Class.forName(name);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CloudRuntimeException("can't find " + name);
|
||||
throw new JsonParseException("can't find " + name);
|
||||
}
|
||||
T cmd = (T)_gson.fromJson(entry.getValue(), clazz);
|
||||
cmds.add(cmd);
|
||||
}
|
||||
Class<?> type = ((Class<?>)typeOfT).getComponentType();
|
||||
T[] ts = (T[])Array.newInstance(type, cmds.size());
|
||||
return cmds.toArray(ts);
|
||||
try {
|
||||
Class<?> type = Class.forName(typeOfT.getTypeName().replace("[]", ""));
|
||||
T[] ts = (T[])Array.newInstance(type, cmds.size());
|
||||
return cmds.toArray(ts);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CloudRuntimeException("can't find " + typeOfT.getTypeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// 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 com.cloud.agent.transport;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.junit.Assert;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.CheckS2SVpnConnectionsAnswer;
|
||||
|
||||
import com.cloud.agent.transport.Request.Version;
|
||||
|
||||
public class ResponseTest extends TestCase {
|
||||
protected Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
public void testCheckS2SVpnConnectionsAnswer() {
|
||||
logger.info("Testing CheckS2SVpnConnectionsAnswer");
|
||||
String content = "[{\"com.cloud.agent.api.CheckS2SVpnConnectionsAnswer\":{\"ipToConnected\":{\"10.0.53.13\":true}," +
|
||||
"\"ipToDetail\":{\"10.0.53.13\":\"IPsec SA found;Site-to-site VPN have connected\"}," +
|
||||
"\"details\":\"10.0.53.13:0:IPsec SA found;Site-to-site VPN have connected\\u0026\\n\"," +
|
||||
"\"result\":true,\"contextMap\":{},\"wait\":0,\"bypassHostMaintenance\":false}}]";
|
||||
Response response = new Response(Version.v2, 1L, 2L, 3L, 1L, (short)1, content);
|
||||
Answer answer = response.getAnswer();
|
||||
Assert.assertTrue(answer instanceof CheckS2SVpnConnectionsAnswer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -85,4 +85,7 @@ mvn install:install-file -Dfile=juniper-contrail-api-1.0-SNAPSHOT.jar -DgroupId=
|
|||
# From https://github.com/radu-todirica/tungsten-api/raw/master/net/juniper/tungsten/juniper-tungsten-api/2.0/juniper-tungsten-api-2.0.jar
|
||||
mvn install:install-file -Dfile=juniper-tungsten-api-2.0.jar -DgroupId=net.juniper.tungsten -DartifactId=juniper-tungsten-api -Dversion=2.0 -Dpackaging=jar
|
||||
|
||||
# Netris Integration
|
||||
mvn install:install-file -Dfile=netris-java-sdk-1.0.0.jar -DgroupId=io.netris -DartifactId=netris-java-sdk -Dversion=1.0.0 -Dpackaging=jar
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ public interface NetworkOrchestrationService {
|
|||
ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
|
||||
"Lock wait timeout (seconds) while implementing network", true, Scope.Global, null);
|
||||
|
||||
ConfigKey<String> DeniedRoutes = new ConfigKey<String>(String.class, "denied.routes", "Network", "",
|
||||
"Routes that are denied, can not be used for Static Routes creation for the VPC Private Gateway", true, ConfigKey.Scope.Zone, null);
|
||||
|
||||
ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
|
||||
"Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null);
|
||||
|
||||
|
|
@ -109,6 +112,9 @@ public interface NetworkOrchestrationService {
|
|||
static final ConfigKey<Boolean> NSX_ENABLED = new ConfigKey<>(Boolean.class, "nsx.plugin.enable", "Advanced", "false",
|
||||
"Indicates whether to enable the NSX plugin", false, ConfigKey.Scope.Zone, null);
|
||||
|
||||
ConfigKey<Boolean> NETRIS_ENABLED = new ConfigKey<>(Boolean.class, "netris.plugin.enable", "Advanced", "false",
|
||||
"Indicates whether to enable the Netris plugin", false, ConfigKey.Scope.Zone, null);
|
||||
|
||||
List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
|
||||
throws ConcurrentOperationException;
|
||||
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ public interface ConfigurationManager {
|
|||
* @param forVpc
|
||||
* @param forTungsten
|
||||
* @param forNsx
|
||||
* @param forNetris
|
||||
* @param domainIds
|
||||
* @param zoneIds
|
||||
* @return network offering object
|
||||
|
|
@ -223,11 +224,11 @@ public interface ConfigurationManager {
|
|||
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
|
||||
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
|
||||
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc,
|
||||
Boolean forTungsten, boolean forNsx, NetworkOffering.NetworkMode networkMode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol,
|
||||
Boolean forTungsten, boolean forNsx, boolean forNetris, NetworkOffering.NetworkMode networkMode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol,
|
||||
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
|
||||
|
||||
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP,
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, boolean forNsx)
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, Provider provider)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
|
||||
void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;
|
||||
|
|
|
|||
|
|
@ -275,5 +275,9 @@ public class PublicIp implements PublicIpAddress {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForRouter() {
|
||||
return _addr.isForRouter();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public interface RulesManager extends RulesService {
|
|||
|
||||
boolean disableStaticNat(long ipAddressId, Account caller, long callerUserId, boolean releaseIpIfElastic) throws ResourceUnavailableException;
|
||||
|
||||
boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke);
|
||||
|
||||
/**
|
||||
* @param networkId
|
||||
* @param continueOnError
|
||||
|
|
|
|||
|
|
@ -93,5 +93,5 @@ public interface NetworkACLManager {
|
|||
|
||||
boolean applyACLToPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException;
|
||||
|
||||
boolean reorderAclRules(VpcVO vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems);
|
||||
boolean reorderAclRules(VpcVO vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems, Network.Provider networkProvider);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.cloud.network.Network.Provider;
|
|||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.addr.PublicIp;
|
||||
import com.cloud.network.dao.IPAddressVO;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
|
@ -174,4 +175,20 @@ public interface VpcManager {
|
|||
* @return
|
||||
*/
|
||||
boolean isSrcNatIpRequired(long vpcOfferingId);
|
||||
|
||||
boolean isSrcNatIpRequiredForVpcVr(long vpcOfferingId);
|
||||
|
||||
List<StaticRouteVO> getVpcStaticRoutes(Long vpcId);
|
||||
|
||||
List<StaticRouteProfile> getVpcStaticRoutes(List<? extends StaticRoute> routes);
|
||||
|
||||
boolean isProviderSupportServiceInVpc(long vpcId, Service service, Provider provider);
|
||||
|
||||
IPAddressVO getIpAddressForVpcVr(Vpc vpc, IPAddressVO ipAddress, boolean allocateIpIfNeeded);
|
||||
|
||||
boolean configStaticNatForVpcVr(Vpc vpc, IPAddressVO ipAddress);
|
||||
|
||||
void reconfigStaticNatForVpcVr(Long vpcId);
|
||||
|
||||
boolean applyStaticRouteForVpcVpnIfNeeded(Long vpcId, boolean updateAllVpn) throws ResourceUnavailableException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ import com.cloud.bgp.BGPService;
|
|||
import com.cloud.dc.VlanDetailsVO;
|
||||
import com.cloud.dc.dao.ASNumberDao;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import com.cloud.network.dao.Ipv6GuestPrefixSubnetNetworkMapDao;
|
||||
import com.cloud.network.dao.NetrisProviderDao;
|
||||
import com.cloud.network.dao.NsxProviderDao;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.annotation.AnnotationService;
|
||||
|
|
@ -355,9 +357,13 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
@Inject
|
||||
private NsxProviderDao nsxProviderDao;
|
||||
@Inject
|
||||
private NetrisProviderDao netrisProviderDao;
|
||||
@Inject
|
||||
private ASNumberDao asNumberDao;
|
||||
@Inject
|
||||
private BGPService bgpService;
|
||||
@Inject
|
||||
private Ipv6GuestPrefixSubnetNetworkMapDao ipv6GuestPrefixSubnetNetworkMapDao;
|
||||
|
||||
@Override
|
||||
public List<NetworkGuru> getNetworkGurus() {
|
||||
|
|
@ -558,27 +564,27 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
|
||||
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
|
||||
false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
|
||||
false, null, false, null, true, false, false, false, false,null, null, null, true, null, null, false);
|
||||
}
|
||||
|
||||
//#2 - SG enabled network offering
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
|
||||
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
|
||||
null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
|
||||
null, true, false, null, false, null, true, false, false, false, false,null, null, null, true, null, null, false);
|
||||
}
|
||||
|
||||
//#3 - shared network offering with no SG service
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
|
||||
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
|
||||
null, true, false, false, false, null,null, null, true, null, null, false);
|
||||
null, true, false, false, false, false,null,null, null, true, null, null, false);
|
||||
}
|
||||
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE, "Offering for Tungsten Shared Security group enabled networks",
|
||||
TrafficType.Guest, null, true, Availability.Optional, null, defaultTungstenSharedSGEnabledNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
|
||||
null, true, false, null, false, null, true, false, true, false, null, null,null, true, null, null, false);
|
||||
null, true, false, null, false, null, true, false, true, false, false,null, null,null, true, null, null, false);
|
||||
offering.setState(NetworkOffering.State.Enabled);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
|
@ -588,14 +594,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
|
||||
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
|
||||
defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null,
|
||||
true, false, false, false, null, null,null, true, null, null, false);
|
||||
true, false, false, false, false,null, null,null, true, null, null, false);
|
||||
}
|
||||
|
||||
//#5 - default vpc offering with LB service
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
|
||||
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
|
||||
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false);
|
||||
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false,null, null, null,true, null, null, false);
|
||||
}
|
||||
|
||||
//#6 - default vpc offering with no LB service
|
||||
|
|
@ -604,14 +610,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
defaultVPCOffProviders.remove(Service.Lb);
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
|
||||
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
|
||||
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null, null, false);
|
||||
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false,null, null, null,true, null, null, false);
|
||||
}
|
||||
|
||||
//#7 - isolated offering with source nat disabled
|
||||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
|
||||
TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null,
|
||||
true, null, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
|
||||
true, null, true, false, null, false, null, true, false, false, false, false,null, null, null, true, null, null, false);
|
||||
}
|
||||
|
||||
//#8 - network offering with internal lb service
|
||||
|
|
@ -633,7 +639,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
|
||||
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
|
||||
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, true, null, null, false);
|
||||
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, false,null, null, null, true, null, null, false);
|
||||
offering.setInternalLb(true);
|
||||
offering.setPublicLb(false);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
|
|
@ -664,7 +670,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
|
||||
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
|
||||
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
|
||||
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, null, null, null, true, null, null, false);
|
||||
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false,false, null, null, null, true, null, null, false);
|
||||
offering.setDedicatedLB(false);
|
||||
_networkOfferingDao.update(offering.getId(), offering);
|
||||
}
|
||||
|
|
@ -821,6 +827,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
if (domainId != null && aclType == ACLType.Domain) {
|
||||
_networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null || subdomainAccess);
|
||||
}
|
||||
String ipv6Cidr = network.getIp6Cidr();
|
||||
String ipv6Gateway = network.getIp6Gateway();
|
||||
if (StringUtils.isNoneBlank(ipv6Cidr, ipv6Gateway)) {
|
||||
ipv6Service.assignIpv6SubnetToNetwork(ipv6Cidr, networkPersisted.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
guru.setup(network, relatedFile);
|
||||
|
|
@ -1055,7 +1066,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
return Transaction.execute(new TransactionCallback<NicVO>() {
|
||||
@Override
|
||||
public NicVO doInTransaction(TransactionStatus status) {
|
||||
NicVO vo = _nicDao.findByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId);
|
||||
NicVO vo = _nicDao.findNonPlaceHolderByIp4AddressAndNetworkId(profile.getIPv4Address(), networkId);
|
||||
if (vo == null) {
|
||||
applyProfileToNic(nic, profile, deviceId);
|
||||
vo = _nicDao.persist(nic);
|
||||
|
|
@ -1082,10 +1093,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
return null;
|
||||
}
|
||||
|
||||
if (isNicAllocatedForNsxPublicNetworkOnVR(network, profile, vm)) {
|
||||
if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Nsx)) {
|
||||
String guruName = "NsxPublicNetworkGuru";
|
||||
NetworkGuru nsxGuru = AdapterBase.getAdapterByName(networkGurus, guruName);
|
||||
nsxGuru.allocate(network, profile, vm);
|
||||
} else if (isNicAllocatedForProviderPublicNetworkOnVR(network, profile, vm, Provider.Netris)) {
|
||||
String guruName = "NetrisPublicNetworkGuru";
|
||||
NetworkGuru netrisGuru = AdapterBase.getAdapterByName(networkGurus, guruName);
|
||||
netrisGuru.allocate(network, profile, vm);
|
||||
}
|
||||
|
||||
if (isDefaultNic != null) {
|
||||
|
|
@ -1148,7 +1163,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
return new Pair<NicProfile, Integer>(vmNic, Integer.valueOf(deviceId));
|
||||
}
|
||||
|
||||
private boolean isNicAllocatedForNsxPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm) {
|
||||
private boolean isNicAllocatedForProviderPublicNetworkOnVR(Network network, NicProfile requested, VirtualMachineProfile vm, Provider provider) {
|
||||
if (ObjectUtils.anyNull(network, requested, vm)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1158,7 +1173,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
return false;
|
||||
}
|
||||
long dataCenterId = vm.getVirtualMachine().getDataCenterId();
|
||||
if (nsxProviderDao.findByZoneId(dataCenterId) == null) {
|
||||
if (Provider.Nsx == provider && nsxProviderDao.findByZoneId(dataCenterId) == null) {
|
||||
return false;
|
||||
} else if (Provider.Netris == provider && netrisProviderDao.findByZoneId(dataCenterId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1168,14 +1185,16 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
if (CollectionUtils.isEmpty(ips)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ips = ips.stream().filter(x -> !x.getAddress().addr().equals(requested.getIPv4Address())).collect(Collectors.toList());
|
||||
IPAddressVO ip = ips.get(0);
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), ApiConstants.NSX_DETAIL_KEY);
|
||||
String detailKey = Provider.Nsx == provider ? ApiConstants.NSX_DETAIL_KEY : ApiConstants.NETRIS_DETAIL_KEY;
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(ip.getVlanId(), detailKey);
|
||||
if (vlanDetail == null) {
|
||||
return false;
|
||||
}
|
||||
boolean isForNsx = vlanDetail.getValue().equalsIgnoreCase("true");
|
||||
return isForNsx && !ip.isForSystemVms();
|
||||
boolean isForProvider = vlanDetail.getValue().equalsIgnoreCase("true");
|
||||
return isForProvider && !ip.isForSystemVms();
|
||||
}
|
||||
|
||||
private void setMtuDetailsInVRNic(final Pair<NetworkVO, VpcVO> networks, Network network, NicVO vo) {
|
||||
|
|
@ -1696,6 +1715,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
}
|
||||
}
|
||||
}
|
||||
if (network.getVpcId() != null) {
|
||||
_vpcMgr.reconfigStaticNatForVpcVr(network.getVpcId());
|
||||
try {
|
||||
_vpcMgr.applyStaticRouteForVpcVpnIfNeeded(network.getVpcId(), true);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
logger.error("Unable to apply static routes for vpc " + network.getVpcId() + " due to " + e.getMessage());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
for (final NetworkElement element : networkElements) {
|
||||
if (element instanceof AggregatedCommandExecutor && providersToImplement.contains(element.getProvider())) {
|
||||
|
|
@ -1941,6 +1968,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
ip.setOneToOneNat(false);
|
||||
ip.setAssociatedWithVmId(null);
|
||||
ip.setVmIp(null);
|
||||
ip.setForRouter(false);
|
||||
_ipAddressDao.update(ip.getId(), ip);
|
||||
}
|
||||
}
|
||||
|
|
@ -3283,6 +3311,14 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
}
|
||||
}
|
||||
}
|
||||
if (network.getVpcId() != null) {
|
||||
_vpcMgr.reconfigStaticNatForVpcVr(network.getVpcId());
|
||||
try {
|
||||
_vpcMgr.applyStaticRouteForVpcVpnIfNeeded(network.getVpcId(), true);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
logger.error("Unable to apply static routes for vpc " + network.getVpcId() + " due to " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -4863,9 +4899,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout,
|
||||
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes,
|
||||
GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion,
|
||||
PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled,
|
||||
TUNGSTEN_ENABLED, NSX_ENABLED };
|
||||
TUNGSTEN_ENABLED, NSX_ENABLED, NETRIS_ENABLED };
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,4 +64,6 @@ public interface VlanDao extends GenericDao<VlanVO, Long> {
|
|||
List<VlanVO> listIpv6RangeByZoneIdAndVlanId(long zoneId, String vlanId);
|
||||
|
||||
List<VlanVO> listIpv6SupportingVlansByZone(long zoneId);
|
||||
|
||||
List<VlanVO> listVlansForExternalNetworkProvider(long zoneId, String detailKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.dc.VlanDetailsVO;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -67,6 +68,8 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
protected SearchBuilder<VlanVO> ZoneVlanIp6Search;
|
||||
protected SearchBuilder<VlanVO> ZoneIp6Search;
|
||||
protected SearchBuilder<VlanVO> ZoneVlansSearch;
|
||||
protected SearchBuilder<VlanVO> ProviderVlanSearch;
|
||||
protected SearchBuilder<VlanDetailsVO> VlanDetailsProviderSearch;
|
||||
|
||||
protected SearchBuilder<AccountVlanMapVO> AccountVlanMapSearch;
|
||||
protected SearchBuilder<DomainVlanMapVO> DomainVlanMapSearch;
|
||||
|
|
@ -79,6 +82,8 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
protected DomainVlanMapDao _domainVlanMapDao;
|
||||
@Inject
|
||||
protected IPAddressDao _ipAddressDao;
|
||||
@Inject
|
||||
protected VlanDetailsDao vlanDetailsDao;
|
||||
|
||||
@Override
|
||||
public VlanVO findByZoneAndVlanId(long zoneId, String vlanId) {
|
||||
|
|
@ -277,6 +282,19 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
ZoneVlansSearch.and("zoneId", ZoneVlansSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
ZoneVlansSearch.and("vlan", ZoneVlansSearch.entity().getVlanTag(), SearchCriteria.Op.IN);
|
||||
ZoneVlansSearch.done();
|
||||
|
||||
ProviderVlanSearch = createSearchBuilder();
|
||||
ProviderVlanSearch.and("removed", ProviderVlanSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
|
||||
ProviderVlanSearch.and("dataCenterId", ProviderVlanSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
VlanDetailsProviderSearch = vlanDetailsDao.createSearchBuilder();
|
||||
VlanDetailsProviderSearch.and("name", VlanDetailsProviderSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
VlanDetailsProviderSearch.and("value", VlanDetailsProviderSearch.entity().getValue(), SearchCriteria.Op.EQ);
|
||||
ProviderVlanSearch.join("VlanDetailsProviderSearch", VlanDetailsProviderSearch, ProviderVlanSearch.entity().getId(),
|
||||
VlanDetailsProviderSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
|
||||
|
||||
VlanDetailsProviderSearch.done();
|
||||
ProviderVlanSearch.done();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -434,4 +452,13 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao
|
|||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VlanVO> listVlansForExternalNetworkProvider(long zoneId, String detailKey) {
|
||||
SearchCriteria<VlanVO> sc = ProviderVlanSearch.create();
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
sc.setJoinParameters("VlanDetailsProviderSearch", "name", detailKey);
|
||||
sc.setJoinParameters("VlanDetailsProviderSearch", "value", "true");
|
||||
return search(sc, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
|
|||
address.setSourceNat(false);
|
||||
address.setOneToOneNat(false);
|
||||
address.setAssociatedWithVmId(null);
|
||||
address.setForRouter(false);
|
||||
address.setState(State.Free);
|
||||
address.setAssociatedWithNetworkId(null);
|
||||
address.setVpcId(null);
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ public class IPAddressVO implements IpAddress {
|
|||
@Column(name = "forsystemvms")
|
||||
private boolean forSystemVms = false;
|
||||
|
||||
@Column(name = "for_router")
|
||||
private boolean forRouter = false;
|
||||
|
||||
@Column(name= GenericDao.REMOVED_COLUMN)
|
||||
private Date removed;
|
||||
|
||||
|
|
@ -385,4 +388,13 @@ public class IPAddressVO implements IpAddress {
|
|||
public boolean isForSystemVms() {
|
||||
return forSystemVms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForRouter() {
|
||||
return forRouter;
|
||||
}
|
||||
|
||||
public void setForRouter(boolean forRouter) {
|
||||
this.forRouter = forRouter;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
// 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 com.cloud.network.dao;
|
||||
|
||||
import com.cloud.network.element.NetrisProviderVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface NetrisProviderDao extends GenericDao<NetrisProviderVO, Long> {
|
||||
NetrisProviderVO findByZoneId(long zoneId);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
// 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 com.cloud.network.dao;
|
||||
|
||||
import com.cloud.network.element.NetrisProviderVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@DB()
|
||||
public class NetrisProviderDaoImpl extends GenericDaoBase<NetrisProviderVO, Long> implements NetrisProviderDao {
|
||||
|
||||
final SearchBuilder<NetrisProviderVO> allFieldsSearch;
|
||||
|
||||
public NetrisProviderDaoImpl() {
|
||||
super();
|
||||
allFieldsSearch = createSearchBuilder();
|
||||
allFieldsSearch.and("id", allFieldsSearch.entity().getId(),
|
||||
SearchCriteria.Op.EQ);
|
||||
allFieldsSearch.and("uuid", allFieldsSearch.entity().getUuid(),
|
||||
SearchCriteria.Op.EQ);
|
||||
allFieldsSearch.and("hostname", allFieldsSearch.entity().getUrl(),
|
||||
SearchCriteria.Op.EQ);
|
||||
allFieldsSearch.and("zone_id", allFieldsSearch.entity().getZoneId(),
|
||||
SearchCriteria.Op.EQ);
|
||||
allFieldsSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetrisProviderVO findByZoneId(long zoneId) {
|
||||
SearchCriteria<NetrisProviderVO> sc = allFieldsSearch.create();
|
||||
sc.setParameters("zone_id", zoneId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,4 +33,6 @@ public interface RemoteAccessVpnDao extends GenericDao<RemoteAccessVpnVO, Long>
|
|||
List<RemoteAccessVpnVO> findByAccount(Long accountId);
|
||||
|
||||
List<RemoteAccessVpnVO> listByNetworkId(Long networkId);
|
||||
|
||||
List<RemoteAccessVpnVO> listByVpcId(Long vpcId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,4 +85,11 @@ public class RemoteAccessVpnDaoImpl extends GenericDaoBase<RemoteAccessVpnVO, Lo
|
|||
sc.setParameters("networkId", networkId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RemoteAccessVpnVO> listByVpcId(Long vpcId) {
|
||||
SearchCriteria<RemoteAccessVpnVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("vpcId", vpcId);
|
||||
return listBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,4 +20,6 @@ import com.cloud.utils.db.GenericDao;
|
|||
|
||||
public interface Site2SiteVpnGatewayDao extends GenericDao<Site2SiteVpnGatewayVO, Long> {
|
||||
Site2SiteVpnGatewayVO findByVpcId(long vpcId);
|
||||
|
||||
Site2SiteVpnGatewayVO findByPublicIpAddress(long ipAddressId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatew
|
|||
protected Site2SiteVpnGatewayDaoImpl() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("ipAddressId", AllFieldsSearch.entity().getAddrId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
}
|
||||
|
||||
|
|
@ -44,4 +45,11 @@ public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatew
|
|||
sc.setParameters("vpcId", vpcId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Site2SiteVpnGatewayVO findByPublicIpAddress(long ipAddressId) {
|
||||
SearchCriteria<Site2SiteVpnGatewayVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("ipAddressId", ipAddressId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,265 @@
|
|||
// 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 com.cloud.network.element;
|
||||
|
||||
import com.cloud.network.netris.NetrisProvider;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "netris_providers")
|
||||
public class NetrisProviderVO implements NetrisProvider {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
long id;
|
||||
|
||||
@Column(name = "uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "zone_id")
|
||||
private long zoneId;
|
||||
|
||||
@Column(name = "host_id")
|
||||
private long hostId;
|
||||
|
||||
@Column(name = "url")
|
||||
private String url;
|
||||
|
||||
@Column(name = "username")
|
||||
private String username;
|
||||
|
||||
@Column(name = "password")
|
||||
private String password;
|
||||
|
||||
@Column(name = "site_name")
|
||||
private String siteName;
|
||||
|
||||
@Column(name = "tenant_name")
|
||||
private String tenantName;
|
||||
|
||||
@Column(name = "netris_tag")
|
||||
private String netrisTag;
|
||||
|
||||
@Column(name = "created")
|
||||
private Date created;
|
||||
|
||||
@Column(name = "removed")
|
||||
private Date removed;
|
||||
|
||||
public NetrisProviderVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public void setHostId(long hostId) {
|
||||
this.hostId = hostId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSiteName() {
|
||||
return siteName;
|
||||
}
|
||||
|
||||
public void setSiteName(String siteName) {
|
||||
this.siteName = siteName;
|
||||
}
|
||||
|
||||
public String getTenantName() {
|
||||
return tenantName;
|
||||
}
|
||||
|
||||
public void setTenantName(String tenantName) {
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getNetrisTag() {
|
||||
return netrisTag;
|
||||
}
|
||||
|
||||
public void setNetrisTag(String netrisTag) {
|
||||
this.netrisTag = netrisTag;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
public void setRemoved(Date removed) {
|
||||
this.removed = removed;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private long zoneId;
|
||||
private long hostId;
|
||||
private String name;
|
||||
private String url;
|
||||
private String username;
|
||||
private String password;
|
||||
private String siteName;
|
||||
private String tenantName;
|
||||
private String netrisTag;
|
||||
|
||||
public Builder() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
public Builder setZoneId(long zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHostId(long hostId) {
|
||||
this.hostId = hostId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUsername(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPassword(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSiteName(String siteName) {
|
||||
this.siteName = siteName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTenantName(String tenantName) {
|
||||
this.tenantName = tenantName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setNetrisTag(String netrisTag) {
|
||||
this.netrisTag = netrisTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetrisProviderVO build() {
|
||||
NetrisProviderVO provider = new NetrisProviderVO();
|
||||
provider.setZoneId(this.zoneId);
|
||||
provider.setHostId(this.hostId);
|
||||
provider.setUuid(UUID.randomUUID().toString());
|
||||
provider.setName(this.name);
|
||||
provider.setUrl(this.url);
|
||||
provider.setUsername(this.username);
|
||||
provider.setPassword(this.password);
|
||||
provider.setSiteName(this.siteName);
|
||||
provider.setTenantName(this.tenantName);
|
||||
provider.setNetrisTag(this.netrisTag);
|
||||
provider.setCreated(new Date());
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
|
|
@ -42,7 +43,10 @@ public class StaticRouteVO implements StaticRoute {
|
|||
String uuid;
|
||||
|
||||
@Column(name = "vpc_gateway_id", updatable = false)
|
||||
long vpcGatewayId;
|
||||
Long vpcGatewayId;
|
||||
|
||||
@Column(name = "next_hop")
|
||||
private String nextHop;
|
||||
|
||||
@Column(name = "cidr")
|
||||
private String cidr;
|
||||
|
|
@ -67,6 +71,9 @@ public class StaticRouteVO implements StaticRoute {
|
|||
uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
@Transient
|
||||
boolean forVpn = false;
|
||||
|
||||
/**
|
||||
* @param vpcGatewayId
|
||||
* @param cidr
|
||||
|
|
@ -74,7 +81,7 @@ public class StaticRouteVO implements StaticRoute {
|
|||
* @param accountId TODO
|
||||
* @param domainId TODO
|
||||
*/
|
||||
public StaticRouteVO(long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId) {
|
||||
public StaticRouteVO(Long vpcGatewayId, String cidr, Long vpcId, long accountId, long domainId, String nextHop) {
|
||||
super();
|
||||
this.vpcGatewayId = vpcGatewayId;
|
||||
this.cidr = cidr;
|
||||
|
|
@ -82,14 +89,32 @@ public class StaticRouteVO implements StaticRoute {
|
|||
this.vpcId = vpcId;
|
||||
this.accountId = accountId;
|
||||
this.domainId = domainId;
|
||||
this.nextHop = nextHop;
|
||||
uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public StaticRouteVO(String cidr, Long vpcId, long accountId, long domainId, String nextHop, State state, boolean forVpn) {
|
||||
super();
|
||||
this.cidr = cidr;
|
||||
this.state = state;
|
||||
this.vpcId = vpcId;
|
||||
this.accountId = accountId;
|
||||
this.domainId = domainId;
|
||||
this.nextHop = nextHop;
|
||||
uuid = UUID.randomUUID().toString();
|
||||
this.forVpn = forVpn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVpcGatewayId() {
|
||||
public Long getVpcGatewayId() {
|
||||
return vpcGatewayId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNextHop() {
|
||||
return nextHop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
|
|
@ -145,4 +170,8 @@ public class StaticRouteVO implements StaticRoute {
|
|||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isForVpn() {
|
||||
return forVpn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,9 +59,6 @@ public class VpcOfferingVO implements VpcOffering {
|
|||
@Column(name = "default")
|
||||
boolean isDefault = false;
|
||||
|
||||
@Column(name = "for_nsx")
|
||||
boolean forNsx = false;
|
||||
|
||||
@Column(name = "network_mode")
|
||||
NetworkOffering.NetworkMode networkMode;
|
||||
|
||||
|
|
@ -158,14 +155,6 @@ public class VpcOfferingVO implements VpcOffering {
|
|||
return isDefault;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return forNsx;
|
||||
}
|
||||
|
||||
public void setForNsx(boolean forNsx) {
|
||||
this.forNsx = forNsx;
|
||||
}
|
||||
|
||||
public NetworkOffering.NetworkMode getNetworkMode() {
|
||||
return networkMode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package com.cloud.network.vpc.dao;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.vpc.VpcOfferingServiceMapVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
|
@ -37,4 +38,8 @@ public interface VpcOfferingServiceMapDao extends GenericDao<VpcOfferingServiceM
|
|||
|
||||
VpcOfferingServiceMapVO findByServiceProviderAndOfferingId(String service, String provider, long vpcOfferingId);
|
||||
|
||||
boolean isProviderForVpcOffering(Network.Provider provider, long vpcOfferingId);
|
||||
|
||||
List<VpcOfferingServiceMapVO> listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.network.vpc.dao;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
import com.cloud.network.Network;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.network.Network.Service;
|
||||
|
|
@ -110,4 +111,22 @@ public class VpcOfferingServiceMapDaoImpl extends GenericDaoBase<VpcOfferingServ
|
|||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProviderForVpcOffering(Network.Provider provider, long vpcOfferingId) {
|
||||
SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("vpcOffId", vpcOfferingId);
|
||||
sc.setParameters("provider", provider.getName());
|
||||
return findOneBy(sc) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VpcOfferingServiceMapVO> listProvidersForServiceForVpcOffering(long vpcOfferingId, Service service) {
|
||||
SearchCriteria<VpcOfferingServiceMapVO> sc = AllFieldsSearch.create();
|
||||
|
||||
sc.setParameters("vpcOffId", vpcOfferingId);
|
||||
sc.setParameters("service", service.getName());
|
||||
|
||||
return customSearch(sc, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,15 @@ public class VpcServiceMapDaoImpl extends GenericDaoBase<VpcServiceMapVO, Long>
|
|||
|
||||
@Override
|
||||
public boolean canProviderSupportServiceInVpc(long vpcId, Service service, Provider provider) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
SearchCriteria<VpcServiceMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("vpcId", vpcId);
|
||||
sc.setParameters("service", service.getName());
|
||||
sc.setParameters("provider", provider.getName());
|
||||
if (findOneBy(sc) != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -133,12 +133,6 @@ public class NetworkOfferingVO implements NetworkOffering {
|
|||
@Column(name = "for_vpc")
|
||||
boolean forVpc;
|
||||
|
||||
@Column(name = "for_tungsten")
|
||||
boolean forTungsten = false;
|
||||
|
||||
@Column(name = "for_nsx")
|
||||
boolean forNsx = false;
|
||||
|
||||
@Column(name = "network_mode")
|
||||
NetworkMode networkMode;
|
||||
|
||||
|
|
@ -199,24 +193,6 @@ public class NetworkOfferingVO implements NetworkOffering {
|
|||
this.forVpc = isForVpc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForTungsten() {
|
||||
return forTungsten;
|
||||
}
|
||||
|
||||
public void setForTungsten(boolean forTungsten) {
|
||||
this.forTungsten = forTungsten;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForNsx() {
|
||||
return forNsx;
|
||||
}
|
||||
|
||||
public void setForNsx(boolean forNsx) {
|
||||
this.forNsx = forNsx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkMode getNetworkMode() {
|
||||
return networkMode;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,12 @@ public interface NicDao extends GenericDao<NicVO, Long> {
|
|||
|
||||
NicVO findByNetworkIdAndTypeIncludingRemoved(long networkId, VirtualMachine.Type vmType);
|
||||
|
||||
NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType);
|
||||
|
||||
NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId);
|
||||
|
||||
NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId);
|
||||
|
||||
NicVO findByNetworkIdAndMacAddress(long networkId, String mac);
|
||||
|
||||
NicVO findDefaultNicForVM(long instanceId);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
AllFieldsSearch.and("secondaryip", AllFieldsSearch.entity().getSecondaryIp(), Op.EQ);
|
||||
AllFieldsSearch.and("nicid", AllFieldsSearch.entity().getId(), Op.EQ);
|
||||
AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ);
|
||||
AllFieldsSearch.and("strategyNEQ", AllFieldsSearch.entity().getReservationStrategy(), Op.NEQ);
|
||||
AllFieldsSearch.and("reserverName",AllFieldsSearch.entity().getReserver(),Op.EQ);
|
||||
AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
|
||||
AllFieldsSearch.and("deviceid", AllFieldsSearch.entity().getDeviceId(), Op.EQ);
|
||||
|
|
@ -195,6 +196,15 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
return findByNetworkIdAndTypeInternal(networkId, vmType, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findNonPlaceHolderByNetworkIdAndType(long networkId, VirtualMachine.Type vmType) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("network", networkId);
|
||||
sc.setParameters("vmType", vmType);
|
||||
sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString());
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
|
|
@ -222,6 +232,16 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findNonPlaceHolderByIp4AddressAndNetworkId(String ip4Address, long networkId) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("address", ip4Address);
|
||||
sc.setParameters("network", networkId);
|
||||
sc.setParameters("strategyNEQ", Nic.ReservationStrategy.PlaceHolder.toString());
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NicVO findByNetworkIdAndMacAddress(long networkId, String mac) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@
|
|||
<bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
|
||||
<bean id="ovsProviderDaoImpl" class="com.cloud.network.dao.OvsProviderDaoImpl" />
|
||||
<bean id="nsxControllerDaoImpl" class="com.cloud.network.dao.NsxProviderDaoImpl" />
|
||||
<bean id="netrisProviderDaoImpl" class="com.cloud.network.dao.NetrisProviderDaoImpl" />
|
||||
<bean id="tungstenControllerDaoImpl" class="com.cloud.network.dao.TungstenProviderDaoImpl"/>
|
||||
<bean id="physicalNetworkDaoImpl" class="com.cloud.network.dao.PhysicalNetworkDaoImpl" />
|
||||
<bean id="physicalNetworkIsolationMethodDaoImpl" class="com.cloud.network.dao.PhysicalNetworkIsolationMethodDaoImpl" />
|
||||
|
|
|
|||
|
|
@ -425,3 +425,40 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
|
|||
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for vm" ');
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for volumes" ');
|
||||
|
||||
-- Netris Plugin
|
||||
CREATE TABLE `cloud`.`netris_providers` (
|
||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||
`uuid` varchar(40),
|
||||
`zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID',
|
||||
`host_id` bigint unsigned NOT NULL COMMENT 'Host ID',
|
||||
`name` varchar(40),
|
||||
`url` varchar(255) NOT NULL,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`site_name` varchar(255) NOT NULL,
|
||||
`tenant_name` varchar(255) NOT NULL,
|
||||
`netris_tag` varchar(255) NOT NULL,
|
||||
`created` datetime NOT NULL COMMENT 'created date',
|
||||
`removed` datetime COMMENT 'removed date if not null',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_netris_providers__zone_id` FOREIGN KEY `fk_netris_providers__zone_id` (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
|
||||
INDEX `i_netris_providers__zone_id`(`zone_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Drop the Tungsten and NSX columns from the network offerings (replaced by checking the provider on the ntwk_offering_service_map table)
|
||||
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_tungsten`;
|
||||
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_nsx`;
|
||||
|
||||
-- Drop the Tungsten and NSX columns from the VPC offerings (replaced by checking the provider on the vpc_offering_service_map table)
|
||||
ALTER TABLE `cloud`.`vpc_offerings` DROP COLUMN `for_nsx`;
|
||||
|
||||
-- Add next_hop to the static_routes table
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.static_routes', 'next_hop', 'varchar(50) COMMENT "next hop of the static route" AFTER `vpc_gateway_id`');
|
||||
|
||||
-- Add `for_router` to `user_ip_address` table
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_ip_address', 'for_router', 'tinyint(1) DEFAULT 0 COMMENT "True if the ip address is used by Domain Router to expose services"');
|
||||
|
||||
-- Add Netris Autoscaling rules
|
||||
INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'cpu', 'VM CPU - average percentage', 'vm.cpu.average.percentage', NOW());
|
||||
INSERT IGNORE INTO `cloud`.`counter` (uuid, provider, source, name, value, created) VALUES (UUID(), 'Netris', 'memory', 'VM Memory - average percentage', 'vm.memory.average.percentage', NOW());
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ SELECT
|
|||
`network_offerings`.`supports_public_access` AS `supports_public_access`,
|
||||
`network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`,
|
||||
`network_offerings`.`for_vpc` AS `for_vpc`,
|
||||
`network_offerings`.`for_tungsten` AS `for_tungsten`,
|
||||
`network_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`network_offerings`.`network_mode` AS `network_mode`,
|
||||
`network_offerings`.`service_package_id` AS `service_package_id`,
|
||||
`network_offerings`.`routing_mode` AS `routing_mode`,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ select
|
|||
`vpc_offerings`.`display_text` AS `display_text`,
|
||||
`vpc_offerings`.`state` AS `state`,
|
||||
`vpc_offerings`.`default` AS `default`,
|
||||
`vpc_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`vpc_offerings`.`network_mode` AS `network_mode`,
|
||||
`vpc_offerings`.`created` AS `created`,
|
||||
`vpc_offerings`.`removed` AS `removed`,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.GuestType;
|
||||
|
|
@ -125,6 +126,11 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
|||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.GuestType;
|
||||
|
|
@ -161,6 +162,11 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void releaseVlan(Network network, VirtualMachineProfile vm) {
|
||||
vlanMgr.releaseVlan(network, vm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
|||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
|
|
@ -124,6 +125,11 @@ public class BaremetalUserdataElement extends AdapterBase implements NetworkElem
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
private String _controlCidr = NetUtils.getLinkLocalCIDR();
|
||||
private Long libvirtVersion;
|
||||
|
||||
private static boolean isVxlanOrNetris(String protocol) {
|
||||
return protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme()) || protocol.equals(Networks.BroadcastDomainType.Netris.scheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Map<String, Object> params) throws ConfigurationException {
|
||||
|
||||
|
|
@ -177,7 +181,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
|
||||
protected boolean isBroadcastTypeVlanOrVxlan(final NicTO nic) {
|
||||
return nic != null && (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan
|
||||
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan);
|
||||
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Netris);
|
||||
}
|
||||
|
||||
protected boolean isValidProtocolAndVnetId(final String vNetId, final String protocol) {
|
||||
|
|
@ -284,7 +288,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
|
||||
private String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
|
||||
String nic = _pifs.get(pifKey);
|
||||
if (nic == null || protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
|
||||
if (nic == null || isVxlanOrNetris(protocol)) {
|
||||
// if not found in bridge map, maybe traffic label refers to pif already?
|
||||
File pif = new File("/sys/class/net/" + pifKey);
|
||||
if (pif.isDirectory()) {
|
||||
|
|
@ -292,7 +296,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
}
|
||||
}
|
||||
String brName = "";
|
||||
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
|
||||
if (isVxlanOrNetris(protocol)) {
|
||||
brName = generateVxnetBrName(nic, vNetId);
|
||||
} else {
|
||||
brName = generateVnetBrName(nic, vNetId);
|
||||
|
|
@ -304,7 +308,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
private void createVnet(String vnetId, String pif, String brName, String protocol) throws InternalErrorException {
|
||||
synchronized (_vnetBridgeMonitor) {
|
||||
String script = _modifyVlanPath;
|
||||
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
|
||||
if (isVxlanOrNetris(protocol)) {
|
||||
script = _modifyVxlanPath;
|
||||
}
|
||||
final Script command = new Script(script, _timeout, logger);
|
||||
|
|
@ -358,6 +362,7 @@ public class BridgeVifDriver extends VifDriverBase {
|
|||
}
|
||||
|
||||
String scriptPath = null;
|
||||
// TODO: check for netris as well
|
||||
if (cmdout != null && cmdout.contains("vxlan")) {
|
||||
scriptPath = _modifyVxlanPath;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.Set;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
|
||||
import com.cloud.api.commands.DisableCiscoNexusVSMCmd;
|
||||
import com.cloud.api.commands.EnableCiscoNexusVSMCmd;
|
||||
|
|
@ -106,6 +106,11 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2008,7 +2008,6 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
|
|||
forVpc, true, false, false);
|
||||
if (forNsx) {
|
||||
defaultKubernetesServiceNetworkOffering.setNetworkMode(NetworkOffering.NetworkMode.NATTED);
|
||||
defaultKubernetesServiceNetworkOffering.setForNsx(true);
|
||||
}
|
||||
defaultKubernetesServiceNetworkOffering.setSupportsVmAutoScaling(true);
|
||||
defaultKubernetesServiceNetworkOffering.setState(NetworkOffering.State.Enabled);
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
|
|||
metricsResponse.setCpuTotal(hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
metricsResponse.setCpuUsed(hostResponse.getCpuUsed(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
metricsResponse.setCpuAllocated(hostResponse.getCpuAllocated(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
metricsResponse.setLoadAverage(hostResponse.getAverageLoad());
|
||||
metricsResponse.setCpuAverageLoad(hostResponse.getAverageLoad());
|
||||
metricsResponse.setMemTotal(hostResponse.getMemoryTotal());
|
||||
metricsResponse.setMemAllocated(hostResponse.getMemoryAllocated());
|
||||
metricsResponse.setMemUsed(hostResponse.getMemoryUsed());
|
||||
|
|
|
|||
|
|
@ -52,10 +52,6 @@ public class HostMetricsResponse extends HostResponse {
|
|||
@Param(description = "the total cpu allocated in Ghz")
|
||||
private String cpuAllocated;
|
||||
|
||||
@SerializedName("cpuloadaverage")
|
||||
@Param(description = "the average cpu load the last minute")
|
||||
private Double loadAverage;
|
||||
|
||||
@SerializedName("memorytotalgb")
|
||||
@Param(description = "the total memory capacity in GiB")
|
||||
private String memTotal;
|
||||
|
|
@ -132,12 +128,6 @@ public class HostMetricsResponse extends HostResponse {
|
|||
}
|
||||
}
|
||||
|
||||
public void setLoadAverage(final Double loadAverage) {
|
||||
if (loadAverage != null) {
|
||||
this.loadAverage = loadAverage;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCpuAllocated(final String cpuAllocated, final Integer cpuNumber, final Long cpuSpeed) {
|
||||
if (cpuAllocated != null && cpuNumber != null && cpuSpeed != null) {
|
||||
this.cpuAllocated = String.format("%.2f Ghz", parseCPU(cpuAllocated) * cpuNumber * cpuSpeed / (100.0 * 1000.0));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.UUID;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import org.apache.commons.net.util.SubnetUtils;
|
||||
|
|
@ -318,6 +319,11 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
if (!canHandle(network, Service.Connectivity)) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.util.UUID;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -194,6 +195,11 @@ public class BrocadeVcsElement extends AdapterBase implements NetworkElement, Re
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
if (!canHandle(network, Service.Connectivity)) {
|
||||
|
|
|
|||
|
|
@ -434,6 +434,11 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean cleanupLogicalEdgeFirewall(long vlanId, long hostId) {
|
||||
CleanupLogicalEdgeFirewallCommand cmd = new CleanupLogicalEdgeFirewallCommand(vlanId);
|
||||
Answer answer = _agentMgr.easySend(hostId, cmd);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.cloud.deploy.DeployDestination;
|
|||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Capability;
|
||||
import com.cloud.network.Network.Provider;
|
||||
|
|
@ -86,6 +87,11 @@ public class DnsNotifier extends AdapterBase implements NetworkElement {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
|
@ -136,6 +137,11 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO kill all loadbalancer vms by calling the ElasticLoadBalancerManager
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -175,6 +176,11 @@ public class GloboDnsElement extends AdapterBase implements ResourceStateAdapter
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
|
|
@ -221,6 +222,11 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<? extends VirtualRouter> internalLbVms = _routerDao.listByNetworkAndRole(network.getId(), Role.INTERNAL_LB_VM);
|
||||
|
|
|
|||
|
|
@ -244,6 +244,11 @@ public class ContrailElementImpl extends AdapterBase
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean releaseIp(IpAddress ipAddress) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Network disable
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||
ConfigurationManager configMgr = (ConfigurationManager) _configService;
|
||||
NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText,
|
||||
TrafficType.Public, null, true, Availability.Optional, null, serviceProviderMap, true,
|
||||
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, false, false, null, null, null, true, null, null, false);
|
||||
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, false, false, false,null, null, null, true, null, null, false);
|
||||
long id = voffer.getId();
|
||||
_networkOfferingDao.update(id, voffer);
|
||||
return _networkOfferingDao.findById(id);
|
||||
|
|
@ -252,7 +252,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||
ConfigurationManager configMgr = (ConfigurationManager)_configService;
|
||||
NetworkOfferingVO voffer =
|
||||
configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true,
|
||||
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), false, false, null, null, null, true, null, null, false);
|
||||
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), false, false, false,null, null, null, true, null, null, false);
|
||||
if (offeringName.equals(vpcRouterOfferingName)) {
|
||||
voffer.setInternalLb(true);
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
|
|||
}
|
||||
serviceProviderMap.put(svc, providerSet);
|
||||
}
|
||||
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, false, null, null, null, VpcOffering.State.Enabled, null, false);
|
||||
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, null, null, null, null, VpcOffering.State.Enabled, null, false);
|
||||
long id = vpcOffer.getId();
|
||||
_vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
|
||||
return _vpcOffDao.findById(id);
|
||||
|
|
|
|||
|
|
@ -201,4 +201,9 @@ public class ContrailVpcElementImpl extends ContrailElementImpl implements Netwo
|
|||
public boolean updateVpcSourceNatIp(Vpc vpc, IpAddress address) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateVpc(Vpc vpc, String previousVpcName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cloud-plugin-network-netris</artifactId>
|
||||
<name>Apache CloudStack Plugin - Netris</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack-plugins</artifactId>
|
||||
<version>4.20.0.0</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.netris</groupId>
|
||||
<artifactId>netris-java-sdk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.seancfoley</groupId>
|
||||
<artifactId>ipaddress</artifactId>
|
||||
<version>5.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// 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;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.host.Host;
|
||||
|
||||
public class StartupNetrisCommand extends StartupCommand {
|
||||
public StartupNetrisCommand() {
|
||||
super(Host.Type.L2Networking);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
// 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.agent.api;
|
||||
|
||||
public class AddOrUpdateNetrisStaticRouteCommand extends NetrisCommand {
|
||||
private String prefix;
|
||||
private String nextHop;
|
||||
private Long routeId;
|
||||
private boolean updateRoute;
|
||||
|
||||
public AddOrUpdateNetrisStaticRouteCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc, String prefix, String nextHop, Long routeId, boolean updateRoute) {
|
||||
super(zoneId, accountId, domainId, name, id, isVpc);
|
||||
this.prefix = prefix;
|
||||
this.nextHop = nextHop;
|
||||
this.routeId = routeId;
|
||||
this.updateRoute = updateRoute;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public String getNextHop() {
|
||||
return nextHop;
|
||||
}
|
||||
|
||||
public Long getRouteId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
public boolean isUpdateRoute() {
|
||||
return updateRoute;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
// 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.agent.api;
|
||||
|
||||
import org.apache.cloudstack.resource.NetrisPortGroup;
|
||||
|
||||
public class CreateNetrisACLCommand extends NetrisCommand {
|
||||
private String vpcName;
|
||||
private Long vpcId;
|
||||
private String action;
|
||||
private String destPrefix;
|
||||
private String sourcePrefix;
|
||||
private Integer destPortStart;
|
||||
private Integer destPortEnd;
|
||||
private Integer icmpType;
|
||||
private String protocol;
|
||||
private NetrisPortGroup portGroup;
|
||||
private String netrisAclName;
|
||||
private String reason;
|
||||
|
||||
|
||||
public CreateNetrisACLCommand(long zoneId, Long accountId, Long domainId, String name, Long id, String vpcName, Long vpcId, boolean isVpc, String action,
|
||||
String sourcePrefix, String destPrefix, Integer destPortStart, Integer destPortEnd, String protocol) {
|
||||
super(zoneId, accountId, domainId, name, id, isVpc);
|
||||
this.vpcName = vpcName;
|
||||
this.vpcId = vpcId;
|
||||
this.action = action;
|
||||
this.sourcePrefix = sourcePrefix;
|
||||
this.destPrefix = destPrefix;
|
||||
this.destPortStart = destPortStart;
|
||||
this.destPortEnd = destPortEnd;
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public void setVpcName(String vpcName) {
|
||||
this.vpcName = vpcName;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public String getDestPrefix() {
|
||||
return destPrefix;
|
||||
}
|
||||
|
||||
public String getSourcePrefix() {
|
||||
return sourcePrefix;
|
||||
}
|
||||
|
||||
public Integer getDestPortStart() {
|
||||
return destPortStart;
|
||||
}
|
||||
|
||||
public Integer getDestPortEnd() {
|
||||
return destPortEnd;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public NetrisPortGroup getPortGroup() {
|
||||
return portGroup;
|
||||
}
|
||||
|
||||
public void setPortGroup(NetrisPortGroup portGroup) {
|
||||
this.portGroup = portGroup;
|
||||
}
|
||||
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public String getNetrisAclName() {
|
||||
return netrisAclName;
|
||||
}
|
||||
|
||||
public void setNetrisAclName(String netrisAclName) {
|
||||
this.netrisAclName = netrisAclName;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
// 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.agent.api;
|
||||
|
||||
public class CreateNetrisVnetCommand extends NetrisCommand {
|
||||
private String vpcName;
|
||||
private Long vpcId;
|
||||
private String cidr;
|
||||
private Integer vxlanId;
|
||||
private String gateway;
|
||||
private String netrisTag;
|
||||
private String ipv6Cidr;
|
||||
private Boolean globalRouting;
|
||||
|
||||
public CreateNetrisVnetCommand(Long zoneId, Long accountId, Long domainId, String vpcName, Long vpcId, String vNetName, Long networkId, String cidr, String gateway, boolean isVpc) {
|
||||
super(zoneId, accountId, domainId, vNetName, networkId, isVpc);
|
||||
this.vpcId = vpcId;
|
||||
this.vpcName = vpcName;
|
||||
this.cidr = cidr;
|
||||
this.gateway = gateway;
|
||||
}
|
||||
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
|
||||
public Integer getVxlanId() {
|
||||
return vxlanId;
|
||||
}
|
||||
|
||||
public void setVxlanId(Integer vxlanId) {
|
||||
this.vxlanId = vxlanId;
|
||||
}
|
||||
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public String getNetrisTag() {
|
||||
return netrisTag;
|
||||
}
|
||||
|
||||
public void setNetrisTag(String netrisTag) {
|
||||
this.netrisTag = netrisTag;
|
||||
}
|
||||
|
||||
public String getIpv6Cidr() {
|
||||
return ipv6Cidr;
|
||||
}
|
||||
|
||||
public void setIpv6Cidr(String ipv6Cidr) {
|
||||
this.ipv6Cidr = ipv6Cidr;
|
||||
}
|
||||
|
||||
public Boolean isGlobalRouting() {
|
||||
return globalRouting;
|
||||
}
|
||||
|
||||
public void setGlobalRouting(Boolean globalRouting) {
|
||||
this.globalRouting = globalRouting;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// 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.agent.api;
|
||||
|
||||
public class CreateNetrisVpcCommand extends NetrisCommand {
|
||||
|
||||
private final String cidr;
|
||||
|
||||
public CreateNetrisVpcCommand(long zoneId, long accountId, long domainId, String name, String cidr, long vpcId, boolean isVpc) {
|
||||
super(zoneId, accountId, domainId, name, vpcId, isVpc);
|
||||
this.cidr = cidr;
|
||||
}
|
||||
|
||||
public String getCidr() {
|
||||
return cidr;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
// 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.agent.api;
|
||||
|
||||
import org.apache.cloudstack.resource.NetrisPortGroup;
|
||||
|
||||
public class CreateOrUpdateNetrisACLCommand extends NetrisCommand {
|
||||
private String vpcName;
|
||||
private Long vpcId;
|
||||
private String action;
|
||||
private String destPrefix;
|
||||
private String sourcePrefix;
|
||||
private Integer destPortStart;
|
||||
private Integer destPortEnd;
|
||||
private Integer icmpType;
|
||||
private String protocol;
|
||||
private NetrisPortGroup portGroup;
|
||||
private String netrisAclName;
|
||||
private String reason;
|
||||
|
||||
|
||||
public CreateOrUpdateNetrisACLCommand(long zoneId, Long accountId, Long domainId, String name, Long id, String vpcName, Long vpcId, boolean isVpc, String action,
|
||||
String sourcePrefix, String destPrefix, Integer destPortStart, Integer destPortEnd, String protocol) {
|
||||
super(zoneId, accountId, domainId, name, id, isVpc);
|
||||
this.vpcName = vpcName;
|
||||
this.vpcId = vpcId;
|
||||
this.action = action;
|
||||
this.sourcePrefix = sourcePrefix;
|
||||
this.destPrefix = destPrefix;
|
||||
this.destPortStart = destPortStart;
|
||||
this.destPortEnd = destPortEnd;
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getVpcName() {
|
||||
return vpcName;
|
||||
}
|
||||
|
||||
public void setVpcName(String vpcName) {
|
||||
this.vpcName = vpcName;
|
||||
}
|
||||
|
||||
public Long getVpcId() {
|
||||
return vpcId;
|
||||
}
|
||||
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public String getDestPrefix() {
|
||||
return destPrefix;
|
||||
}
|
||||
|
||||
public String getSourcePrefix() {
|
||||
return sourcePrefix;
|
||||
}
|
||||
|
||||
public Integer getDestPortStart() {
|
||||
return destPortStart;
|
||||
}
|
||||
|
||||
public Integer getDestPortEnd() {
|
||||
return destPortEnd;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public NetrisPortGroup getPortGroup() {
|
||||
return portGroup;
|
||||
}
|
||||
|
||||
public void setPortGroup(NetrisPortGroup portGroup) {
|
||||
this.portGroup = portGroup;
|
||||
}
|
||||
|
||||
public Integer getIcmpType() {
|
||||
return icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public String getNetrisAclName() {
|
||||
return netrisAclName;
|
||||
}
|
||||
|
||||
public void setNetrisAclName(String netrisAclName) {
|
||||
this.netrisAclName = netrisAclName;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
// 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.agent.api;
|
||||
|
||||
import com.cloud.network.netris.NetrisLbBackend;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreateOrUpdateNetrisLoadBalancerRuleCommand extends NetrisCommand {
|
||||
private final String publicPort;
|
||||
private final String privatePort;
|
||||
private final String algorithm;
|
||||
private final String protocol;
|
||||
List<NetrisLbBackend> lbBackends;
|
||||
private String publicIp;
|
||||
private final Long lbId;
|
||||
private String cidrList;
|
||||
private String ruleName;
|
||||
|
||||
public CreateOrUpdateNetrisLoadBalancerRuleCommand(long zoneId, Long accountId, Long domainId, String name, Long id, boolean isVpc,
|
||||
List<NetrisLbBackend> lbBackends, long lbId, String publicIp, String publicPort,
|
||||
String privatePort, String algorithm, String protocol) {
|
||||
super(zoneId, accountId, domainId, name, id, isVpc);
|
||||
this.lbId = lbId;
|
||||
this.publicIp = publicIp;
|
||||
this.publicPort = publicPort;
|
||||
this.privatePort = privatePort;
|
||||
this.algorithm = algorithm;
|
||||
this.protocol = protocol;
|
||||
this.lbBackends = lbBackends;
|
||||
}
|
||||
|
||||
public String getPublicPort() {
|
||||
return publicPort;
|
||||
}
|
||||
|
||||
public String getPrivatePort() {
|
||||
return privatePort;
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
return algorithm;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public List<NetrisLbBackend> getLbBackends() {
|
||||
return lbBackends;
|
||||
}
|
||||
|
||||
public Long getLbId() {
|
||||
return lbId;
|
||||
}
|
||||
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
public String getCidrList() {
|
||||
return cidrList;
|
||||
}
|
||||
|
||||
public void setCidrList(String cidrList) {
|
||||
this.cidrList = cidrList;
|
||||
}
|
||||
|
||||
public String getRuleName() {
|
||||
return ruleName;
|
||||
}
|
||||
|
||||
public void setRuleName(String ruleName) {
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue