Skip to content

Commit 6ef6464

Browse files
OSPF: WIP: adding dynamically routing capability to VPC
1. Added zone level quagga/ospf config API and UI as addtional tab on zone 2. Added service offering with ospf 3. Modified system vm template so that quagga is pre-installed 4. Added various configuration files that are required by Quagga 5. Added marvin tests for new APIs and unit test TODO: 1. CIDR selection functionality and UI 2. Applying config on the vritual router if quagga is enabled 3. Marvin and unit tests
1 parent e5f0788 commit 6ef6464

File tree

48 files changed

+1613
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1613
-258
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public static class Service {
5959
public static final Service SecurityGroup = new Service("SecurityGroup");
6060
public static final Service NetworkACL = new Service("NetworkACL", Capability.SupportedProtocols);
6161
public static final Service Connectivity = new Service("Connectivity", Capability.DistributedRouter, Capability.RegionLevelVpc, Capability.StretchedL2Subnet);
62+
public static final Service VPCDynamicRouting = new Service("VPCDynamicRouting");
6263

6364
private final String name;
6465
private final Capability[] caps;
@@ -124,6 +125,7 @@ public static class Provider {
124125
public static final Provider ElasticLoadBalancerVm = new Provider("ElasticLoadBalancerVm", false);
125126
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
126127
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
128+
public static final Provider VPCDynamicRouting = new Provider("VPCDynamicRouting", false);
127129
public static final Provider None = new Provider("None", false);
128130
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
129131
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
@@ -213,6 +215,7 @@ public static class Capability {
213215
public static final Capability DistributedRouter = new Capability("DistributedRouter");
214216
public static final Capability StretchedL2Subnet = new Capability("StretchedL2Subnet");
215217
public static final Capability RegionLevelVpc = new Capability("RegionLevelVpc");
218+
public static final Capability DynamicallyRoutedVpc = new Capability("DynamicallyRoutedVpc");
216219

217220
private final String name;
218221

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,10 @@ public enum State {
8787
* @return true if VPC spans multiple zones in the region
8888
*/
8989
boolean isRegionLevelVpc();
90+
91+
/**
92+
*
93+
* @return true if VPC is dynamically routed using ospf
94+
*/
95+
boolean isDynamicallyRouted();
9096
}

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,48 @@
2020
import org.apache.cloudstack.api.InternalIdentity;
2121

2222
public interface VpcOffering extends InternalIdentity, Identity {
23+
2324
public enum State {
2425
Disabled, Enabled
2526
}
2627

2728
public static final String defaultVPCOfferingName = "Default VPC offering";
2829
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
2930
public static final String redundantVPCOfferingName = "Redundant VPC offering";
31+
public static final String routedVPCOfferingName = "Default Dynamically Routed VPC offering";
32+
33+
/**Protocol Dropdown to select the protocol: OSPF or BGP
34+
* OSPF Area Specify the OSPF Area ID
35+
* Hello Interval Set number of seconds for HelloInterval timer value. Setting this value, Hello packet will be sent every timer value seconds on the specified interface. This value must be the same for all routers attached to a common network. The default value is 10 seconds.
36+
* Dead Interval Set number of seconds for RouterDeadInterval timer value used for Wait Timer and Inactivity Timer. This value must be the same for all routers attached to a common network. The default value is 40 seconds.
37+
* Retransmit Interval Set number of seconds for RxmtInterval timer value. This value is used when retransmitting Database Description and Link State Request packets. The default value is 5 seconds.
38+
* Transmit Delay Set number of seconds for InfTransDelay value. LSAs’ age should be incremented by this value when transmitting. The default value is 1 seconds.
39+
* Authentication Dropdown with 2 options: MD5 or Text Plain
40+
* Password The password for OSPF Area
41+
* Super-CIDR** For using dynamic routing a zone level super-cidr is required. This will be carved into network sub levels and into the created routed tiers.
42+
**/
43+
public enum Quagga {
44+
QuaggaProtocol, OSPFArea, QuaggaHelloInterval, QuaggaDeadInterval, QuaggaRetransmitInterval, QuaggaTransitDelay, QuaggaAuthentication, OspfSuperCIDR, QuaggaPassword, QuaggaEnabled
45+
}
46+
47+
public enum QuaggaProtocol {
48+
Ospf, Bgp
49+
}
50+
51+
public enum QuaggaAuthetication {
52+
MD5, PlainText
53+
}
54+
55+
public static final String quaggaProtocol = "quaggaProtocol";
56+
public static final String ospfArea = "ospfArea";
57+
public static final String quaggaHelloInterval = "quaggaHelloInterval";
58+
public static final String quaggaDeadInterval = "quaggaDeadInterval";
59+
public static final String quaggaRetransmitInterval = "quaggaRetransmitInterval";
60+
public static final String quaggaTransitDelay = "quaggaTransitDelay";
61+
public static final String quaggaAuthentication = "quaggaAuthentication";
62+
public static final String ospfSuperCIDR = "ospfSuperCIDR";
63+
public static final String quaggaPassword = "quaggaPassword";
64+
public static final String quaggaEnabled = "quaggaEnabled";
3065

3166
/**
3267
*

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// under the License.
1717
package com.cloud.network.vpc;
1818

19-
2019
import java.util.List;
2120
import java.util.Map;
2221

@@ -26,13 +25,11 @@ public interface VpcProvisioningService {
2625

2726
public VpcOffering getVpcOffering(long vpcOfferingId);
2827

29-
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
30-
Map<String, List<String>> serviceProviders,
31-
Map serviceCapabilitystList,
32-
Long serviceOfferingId);
28+
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders, Map serviceCapabilitystList,
29+
Long serviceOfferingId);
3330

34-
Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword,
35-
String state, Long startIndex, Long pageSizeVal);
31+
Pair<List<? extends VpcOffering>, Integer> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword,
32+
String state, Long startIndex, Long pageSizeVal);
3633

3734
/**
3835
* @param offId
@@ -49,4 +46,9 @@ Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(Long id, String name,
4946
*/
5047
public VpcOffering updateVpcOffering(long vpcOffId, String vpcOfferingName, String displayText, String state);
5148

49+
Map<String, String> quaggaConfigUpdate(Long id, String protocol, String ospfArea, Integer helloInterval, Integer deadInterval, Integer retransmitInterval, Integer transitDelay,
50+
String authentication, String password, String superCIDR, Boolean enabled);
51+
52+
Map<String, String> quaggaConfig(Long id);
53+
5254
}

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ public class ApiConstants {
622622
public static final String MAXCAPACITY = "maxcapacity";
623623
public static final String DISTRIBUTED_VPC_ROUTER = "distributedvpcrouter";
624624
public static final String REDUNDANT_VPC_ROUTER = "redundantvpcrouter";
625+
public static final String DYNAMICALLY_ROUTED_VPC_ROUTER = "dynamicallyroutedvpcrouter";
625626
public static final String READ_ONLY = "readonly";
626627
public static final String SUPPORTS_REGION_LEVEL_VPC = "supportsregionLevelvpc";
627628
public static final String SUPPORTS_STRECHED_L2_SUBNET = "supportsstrechedl2subnet";
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
18+
package org.apache.cloudstack.api.command.admin.vpc;
19+
20+
import java.util.Map;
21+
22+
import javax.inject.Inject;
23+
24+
import org.apache.cloudstack.api.APICommand;
25+
import org.apache.cloudstack.api.ApiConstants;
26+
import org.apache.cloudstack.api.BaseCmd;
27+
import org.apache.cloudstack.api.Parameter;
28+
import org.apache.cloudstack.api.response.VPCQuaggaConfigResponse;
29+
import org.apache.cloudstack.api.response.ZoneResponse;
30+
import org.apache.log4j.Logger;
31+
32+
import com.cloud.network.vpc.VpcProvisioningService;
33+
import com.cloud.user.Account;
34+
35+
@APICommand(name = "vpcQuaggaConfig", description = "Captures config informaton for quagga", responseObject = VPCQuaggaConfigResponse.class, since = "4.8.0", requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
36+
public class VPCQuaggaConfigCmd extends BaseCmd {
37+
public static final Logger s_logger = Logger.getLogger(VPCQuaggaConfigCmd.class.getName());
38+
private static final String s_name = "vpcquaggaconfigresponse";
39+
40+
/////////////////////////////////////////////////////
41+
//////////////// API parameters /////////////////////
42+
/////////////////////////////////////////////////////
43+
44+
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the Zone")
45+
private Long zoneid;
46+
47+
@Inject
48+
public VpcProvisioningService _vpcProvSvc;
49+
50+
public Long getId() {
51+
return zoneid;
52+
}
53+
54+
@Override
55+
public void execute() {
56+
Map<String, String> details = _vpcProvSvc.quaggaConfig(getId());
57+
VPCQuaggaConfigResponse response = new VPCQuaggaConfigResponse(getId(), details);
58+
response.setResponseName(getCommandName());
59+
response.setObjectName("quaggaconfig");
60+
setResponseObject(response);
61+
}
62+
63+
@Override
64+
public String getCommandName() {
65+
return s_name;
66+
}
67+
68+
@Override
69+
public long getEntityOwnerId() {
70+
return Account.ACCOUNT_ID_SYSTEM;
71+
}
72+
73+
}

0 commit comments

Comments
 (0)