|
| 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 javax.inject.Inject; |
| 21 | + |
| 22 | +import org.apache.cloudstack.api.APICommand; |
| 23 | +import org.apache.cloudstack.api.ApiConstants; |
| 24 | +import org.apache.cloudstack.api.BaseCmd; |
| 25 | +import org.apache.cloudstack.api.Parameter; |
| 26 | +import org.apache.cloudstack.api.response.VPCQuaggaConfigResponse; |
| 27 | +import org.apache.cloudstack.api.response.ZoneResponse; |
| 28 | +import org.apache.log4j.Logger; |
| 29 | + |
| 30 | +import com.cloud.network.vpc.VpcProvisioningService; |
| 31 | +import com.cloud.user.Account; |
| 32 | + |
| 33 | +@APICommand(name = "vpcQuaggaConfigCmd", description = "Captures config informaton for quagga", responseObject = VPCQuaggaConfigResponse.class, since = "4.8.0", requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) |
| 34 | +public class VPCQuaggaConfigCmd extends BaseCmd { |
| 35 | + public static final Logger s_logger = Logger.getLogger(VPCQuaggaConfigCmd.class.getName()); |
| 36 | + private static final String s_name = "vpcquaggaconfigresponse"; |
| 37 | + |
| 38 | + ///////////////////////////////////////////////////// |
| 39 | + //////////////// API parameters ///////////////////// |
| 40 | + ///////////////////////////////////////////////////// |
| 41 | + |
| 42 | + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the Zone") |
| 43 | + private Long zoneid; |
| 44 | + |
| 45 | + @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the password used to secure inter quagga communication") |
| 46 | + private String password; |
| 47 | + |
| 48 | + @Parameter(name = ApiConstants.CIDR, type = CommandType.STRING, required = true, description = "the super zone level CIDR for ospf enabled VPCs") |
| 49 | + private String cidr; |
| 50 | + |
| 51 | + @Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "flag to enable or disable quagga for this zone") |
| 52 | + private Boolean enabled; |
| 53 | + |
| 54 | + @Inject |
| 55 | + public VpcProvisioningService _vpcProvSvc; |
| 56 | + |
| 57 | + public Long getId() { |
| 58 | + return zoneid; |
| 59 | + } |
| 60 | + |
| 61 | + public Boolean getQuaggaEnabled() { |
| 62 | + return enabled; |
| 63 | + } |
| 64 | + |
| 65 | + public void setQuaggaEnabled(Boolean quaggaEnabled) { |
| 66 | + this.enabled = quaggaEnabled; |
| 67 | + } |
| 68 | + |
| 69 | + public String getQuaggaPassword() { |
| 70 | + return password; |
| 71 | + } |
| 72 | + |
| 73 | + public void setQuaggaPassword(String quaggaPassword) { |
| 74 | + this.password = quaggaPassword; |
| 75 | + } |
| 76 | + |
| 77 | + public String getSuperCIDR() { |
| 78 | + return cidr; |
| 79 | + } |
| 80 | + |
| 81 | + public void setSuperCIDR(String superCIDR) { |
| 82 | + this.cidr = superCIDR; |
| 83 | + } |
| 84 | + |
| 85 | + @Override |
| 86 | + public void execute() { |
| 87 | + _vpcProvSvc.quaggaConfig(getId(), getQuaggaPassword(), getSuperCIDR(), getQuaggaEnabled()); |
| 88 | + VPCQuaggaConfigResponse response = new VPCQuaggaConfigResponse(); |
| 89 | + response.setResult(true); |
| 90 | + response.setResponseName(getCommandName()); |
| 91 | + response.setObjectName("quaggaconfig"); |
| 92 | + setResponseObject(response); |
| 93 | + } |
| 94 | + |
| 95 | + @Override |
| 96 | + public String getCommandName() { |
| 97 | + return s_name; |
| 98 | + } |
| 99 | + |
| 100 | + @Override |
| 101 | + public long getEntityOwnerId() { |
| 102 | + return Account.ACCOUNT_ID_SYSTEM; |
| 103 | + } |
| 104 | + |
| 105 | +} |
0 commit comments