Skip to content

Commit cf72aa3

Browse files
author
Alena Prokharchyk
committed
Fixes/improvements for VPC feature:
1) Added comments to VPC/VPCService/VPCManager interfaces 2) Moved VPC offering related methods from VpcService to the new interface - VpcProvisioningService 3) Fixed static nat creation in the VPC - used to result in NPE due to invalid method referencing while obtaining VPC VR information
1 parent f8471e5 commit cf72aa3

28 files changed

Lines changed: 395 additions & 307 deletions

api/src/com/cloud/network/NetworkModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,6 @@ Map<PublicIpAddress, Set<Service>> getIpToServices(List<? extends PublicIpAddres
261261
String getStartIpv6Address(long id);
262262

263263
Nic getPlaceholderNic(Network network, Long podId);
264+
265+
boolean isProviderEnabledInZone(long zoneId, String provider);
264266
}

api/src/com/cloud/network/vpc/Vpc.java

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,63 @@
2020
import org.apache.cloudstack.api.Identity;
2121
import org.apache.cloudstack.api.InternalIdentity;
2222

23-
import com.cloud.network.Network;
24-
2523
public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
24+
2625
public enum State {
2726
Enabled,
2827
Inactive
2928
}
3029

31-
public static final String _supportedProviders = Network.Provider.VPCVirtualRouter.getName();
32-
33-
boolean readyToUse();
34-
30+
/**
31+
*
32+
* @return VPC name
33+
*/
3534
String getName();
3635

36+
37+
/**
38+
* @return the id of the zone the VPC belongs to
39+
*/
3740
long getZoneId();
3841

42+
43+
/**
44+
* @return super CIDR of the VPC. All the networks participating in VPC, should have CIDRs that are the part of the super cidr
45+
*/
3946
String getCidr();
4047

48+
/**
49+
*
50+
* @return VPC state
51+
*/
4152
State getState();
4253

54+
55+
/**
56+
*
57+
* @return VPC offering id - the offering that VPC is created from
58+
*/
4359
long getVpcOfferingId();
4460

61+
62+
/**
63+
*
64+
* @return VPC display text
65+
*/
4566
String getDisplayText();
4667

68+
69+
/**
70+
*
71+
* @return VPC network domain. All networks participating in the VPC, become the part of the same network domain
72+
*/
4773
String getNetworkDomain();
4874

75+
76+
/**
77+
*
78+
* @return true if restart is required for the VPC; false otherwise
79+
*/
4980
boolean isRestartRequired();
5081

5182
}

api/src/com/cloud/network/vpc/VpcOffering.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,33 @@ public enum State {
2727

2828
public static final String defaultVPCOfferingName = "Default VPC offering";
2929

30+
/**
31+
*
32+
* @return VPC offering name
33+
*/
3034
String getName();
3135

32-
String getUniqueName();
33-
36+
37+
/**
38+
* @return VPC offering display text
39+
*/
3440
String getDisplayText();
41+
3542

43+
/**
44+
*
45+
* @return VPC offering state
46+
*/
3647
State getState();
3748

49+
/**
50+
*
51+
* @return true if offering is default - came with the cloudStack fresh install; false otherwise
52+
*/
3853
boolean isDefault();
3954

4055
/**
41-
* @return
56+
* @return service offering id used by VPC virutal router
4257
*/
4358
Long getServiceOfferingId();
4459

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.network.vpc;
18+
19+
import java.util.List;
20+
import java.util.Map;
21+
22+
public interface VpcProvisioningService {
23+
24+
public VpcOffering getVpcOffering(long vpcOfferingId);
25+
26+
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders);
27+
28+
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr,
29+
Boolean isDefault, String keyword, String state, Long startIndex, Long pageSizeVal);
30+
31+
/**
32+
* @param offId
33+
* @return
34+
*/
35+
public boolean deleteVpcOffering(long offId);
36+
37+
/**
38+
* @param vpcOffId
39+
* @param vpcOfferingName
40+
* @param displayText
41+
* @param state
42+
* @return
43+
*/
44+
public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
45+
46+
}

0 commit comments

Comments
 (0)