Skip to content

Commit

Permalink
AV-162696: Updated vRO assets for 21.1.6 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhachane committed Nov 25, 2022
1 parent 01f47d8 commit cffbb1e
Show file tree
Hide file tree
Showing 1,151 changed files with 21,596 additions and 10,857 deletions.
11 changes: 9 additions & 2 deletions o11nplugin-vro-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>vro</artifactId>
<groupId>com.vmware.avi</groupId>
<version>21.1.3.RELEASE</version>
<version>21.1.6.RELEASE</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>com.vmware.avi.sdk</groupId>
<artifactId>avisdk</artifactId>
<version>21.1.3.RELEASE</version>
<version>21.1.6.RELEASE</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -148,6 +148,13 @@
<version>4.3.7.RELEASE</version>
<scope>provided</scope>
</dependency>
<!-- only for unit test cases -->
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
40 changes: 15 additions & 25 deletions o11nplugin-vro-core/src/main/java/com/vmware/avi/vro/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Constants {
public static final String FINDER_VRO_WORKFLOW_RUNTIME = "WorkflowRuntime";
public static final String FINDER_VRO_AVI_RUNTIME_INFO = "AviRunTimeInfo";
public static final String FINDER_VRO_CLIENT = "AviVroClient";
public static final String FINDER_VRO_CLIENT_INFO = "AviConnectionInfo";
public static final String FINDER_VRO_PLUGIN_NAME = "Avi";
public static final String FINDER_VRO_PLUGIN = "Vro";
public static final String FINDER_VRO_AVIRESTRESOURCE = "AviRestResource";
Expand All @@ -28,7 +29,6 @@ public class Constants {
public static final String FINDER_VRO_APICNETWORKREL = "APICNetworkRel";
public static final String FINDER_VRO_AWSASGDELETE = "AWSASGDelete";
public static final String FINDER_VRO_AWSASGNOTIFDETAILS = "AWSASGNotifDetails";
public static final String FINDER_VRO_AWSLOGIN = "AWSLogin";
public static final String FINDER_VRO_AWSSETUP = "AWSSetup";
public static final String FINDER_VRO_ABPOOL = "AbPool";
public static final String FINDER_VRO_ACTIONGROUPCONFIG = "ActionGroupConfig";
Expand Down Expand Up @@ -156,6 +156,8 @@ public class Constants {
public static final String FINDER_VRO_CAPTUREIPC = "CaptureIPC";
public static final String FINDER_VRO_CASECONFIG = "CaseConfig";
public static final String FINDER_VRO_CDPLLDPINFO = "CdpLldpInfo";
public static final String FINDER_VRO_CENTRALLICENSEREFRESHDETAILS = "CentralLicenseRefreshDetails";
public static final String FINDER_VRO_CENTRALLICENSESUBSCRIPTIONDETAILS = "CentralLicenseSubscriptionDetails";
public static final String FINDER_VRO_CERTIFICATEAUTHORITY = "CertificateAuthority";
public static final String FINDER_VRO_CERTIFICATEMANAGEMENTPROFILE = "CertificateManagementProfile";
public static final String FINDER_VRO_CFGSTATE = "CfgState";
Expand Down Expand Up @@ -347,7 +349,6 @@ public class Constants {
public static final String FINDER_VRO_EVENTCACHE = "EventCache";
public static final String FINDER_VRO_EVENTDETAILS = "EventDetails";
public static final String FINDER_VRO_EVENTDETAILSFILTER = "EventDetailsFilter";
public static final String FINDER_VRO_EVENTGENPARAMS = "EventGenParams";
public static final String FINDER_VRO_EVENTLOG = "EventLog";
public static final String FINDER_VRO_EVENTMAP = "EventMap";
public static final String FINDER_VRO_FAILACTION = "FailAction";
Expand Down Expand Up @@ -551,6 +552,10 @@ public class Constants {
public static final String FINDER_VRO_KEYVALUE = "KeyValue";
public static final String FINDER_VRO_KEYVALUETUPLE = "KeyValueTuple";
public static final String FINDER_VRO_KNIPORTRANGE = "KniPortRange";
public static final String FINDER_VRO_L1FMANDATORYTESTCASE = "L1FMandatoryTestCase";
public static final String FINDER_VRO_L1STRINGLENGTHTESTCASE = "L1StringLengthTestCase";
public static final String FINDER_VRO_L2FMANDATORYTESTCASE = "L2FMandatoryTestCase";
public static final String FINDER_VRO_L2STRINGLENGTHTESTCASE = "L2StringLengthTestCase";
public static final String FINDER_VRO_L4CONNECTIONPOLICY = "L4ConnectionPolicy";
public static final String FINDER_VRO_L4POLICIES = "L4Policies";
public static final String FINDER_VRO_L4POLICYSET = "L4PolicySet";
Expand All @@ -572,6 +577,7 @@ public class Constants {
public static final String FINDER_VRO_LICENSEEXPIRYDETAILS = "LicenseExpiryDetails";
public static final String FINDER_VRO_LICENSEINFO = "LicenseInfo";
public static final String FINDER_VRO_LICENSELEDGERDETAILS = "LicenseLedgerDetails";
public static final String FINDER_VRO_LICENSESERVICEUPDATE = "LicenseServiceUpdate";
public static final String FINDER_VRO_LICENSESTATUS = "LicenseStatus";
public static final String FINDER_VRO_LICENSETIERSWITCHDETIAILS = "LicenseTierSwitchDetiails";
public static final String FINDER_VRO_LICENSETIERUSAGE = "LicenseTierUsage";
Expand Down Expand Up @@ -694,9 +700,9 @@ public class Constants {
public static final String FINDER_VRO_OPENSTACKSYNCSERVICES = "OpenStackSyncServices";
public static final String FINDER_VRO_OPENSTACKVIPNETWORK = "OpenStackVipNetwork";
public static final String FINDER_VRO_OPENSTACKVNICCHANGE = "OpenStackVnicChange";
public static final String FINDER_VRO_OPENSTACKLOGIN = "OpenstackLogin";
public static final String FINDER_VRO_OPERATIONALSTATUS = "OperationalStatus";
public static final String FINDER_VRO_OPSHISTORY = "OpsHistory";
public static final String FINDER_VRO_ORGSERVICEUNITS = "OrgServiceUnits";
public static final String FINDER_VRO_OSHIFTDOCKERREGISTRYMETADATA = "OshiftDockerRegistryMetaData";
public static final String FINDER_VRO_OSHIFTSHAREDVIRTUALSERVICE = "OshiftSharedVirtualService";
public static final String FINDER_VRO_OUTOFBANDREQUESTLOG = "OutOfBandRequestLog";
Expand Down Expand Up @@ -761,7 +767,6 @@ public class Constants {
public static final String FINDER_VRO_REBALANCESCALEINEVENTDETAILS = "RebalanceScaleinEventDetails";
public static final String FINDER_VRO_REBALANCESCALEOUTEVENTDETAILS = "RebalanceScaleoutEventDetails";
public static final String FINDER_VRO_REBOOTDATA = "RebootData";
public static final String FINDER_VRO_REDISCOVERVCENTERPARAM = "RediscoverVcenterParam";
public static final String FINDER_VRO_REPLACESTRINGVAR = "ReplaceStringVar";
public static final String FINDER_VRO_REPLICATIONPOLICY = "ReplicationPolicy";
public static final String FINDER_VRO_RESPONSEMATCHTARGET = "ResponseMatchTarget";
Expand Down Expand Up @@ -935,6 +940,8 @@ public class Constants {
public static final String FINDER_VRO_SERVICEENGINEFAULTS = "ServiceengineFaults";
public static final String FINDER_VRO_SIDEBANDPROFILE = "SidebandProfile";
public static final String FINDER_VRO_SINGLELICENSE = "SingleLicense";
public static final String FINDER_VRO_SINGLEOPTIONALFIELDMESSAGE = "SingleOptionalFieldMessage";
public static final String FINDER_VRO_SINGLEOPTIONALSTRINGFIELD = "SingleOptionalStringField";
public static final String FINDER_VRO_SIPLOG = "SipLog";
public static final String FINDER_VRO_SIPMESSAGE = "SipMessage";
public static final String FINDER_VRO_SIPSERVICEAPPLICATIONPROFILE = "SipServiceApplicationProfile";
Expand Down Expand Up @@ -1011,42 +1018,24 @@ public class Constants {
public static final String FINDER_VRO_VCENTERCREDENTIALS = "VCenterCredentials";
public static final String FINDER_VRO_VCENTERSERVER = "VCenterServer";
public static final String FINDER_VRO_VHMATCH = "VHMatch";
public static final String FINDER_VRO_VIADMINCREDENTIALS = "VIAdminCredentials";
public static final String FINDER_VRO_VICONTROLLERVNICINFO = "VIControllerVnicInfo";
public static final String FINDER_VRO_VICREATESEREQ = "VICreateSEReq";
public static final String FINDER_VRO_VIDCINFO = "VIDCInfo";
public static final String FINDER_VRO_VIDELETENETWORKFILTER = "VIDeleteNetworkFilter";
public static final String FINDER_VRO_VIDELETESEREQ = "VIDeleteSEReq";
public static final String FINDER_VRO_VIFAULTINJECTION = "VIFaultInjection";
public static final String FINDER_VRO_VIGUESTVNICIPADDR = "VIGuestvNicIPAddr";
public static final String FINDER_VRO_VIMGRCLUSTERRUNTIME = "VIMgrClusterRuntime";
public static final String FINDER_VRO_VIMGRCONTROLLERRUNTIME = "VIMgrControllerRuntime";
public static final String FINDER_VRO_VIMGRDCRUNTIME = "VIMgrDCRuntime";
public static final String FINDER_VRO_VIMGRGUESTNICRUNTIME = "VIMgrGuestNicRuntime";
public static final String FINDER_VRO_VIMGRHOSTRUNTIME = "VIMgrHostRuntime";
public static final String FINDER_VRO_VIMGRIPSUBNETRUNTIME = "VIMgrIPSubnetRuntime";
public static final String FINDER_VRO_VIMGRINTERESTEDENTITY = "VIMgrInterestedEntity";
public static final String FINDER_VRO_VIMGRNWRUNTIME = "VIMgrNWRuntime";
public static final String FINDER_VRO_VIMGRSEVMRUNTIME = "VIMgrSEVMRuntime";
public static final String FINDER_VRO_VIMGRVMRUNTIME = "VIMgrVMRuntime";
public static final String FINDER_VRO_VIMGRVCENTERRUNTIME = "VIMgrVcenterRuntime";
public static final String FINDER_VRO_VIPGNAMEINFO = "VIPGNameInfo";
public static final String FINDER_VRO_VIRETRIEVEPGNAMES = "VIRetrievePGNames";
public static final String FINDER_VRO_VISEVMIPCONFPARAMS = "VISeVmIpConfParams";
public static final String FINDER_VRO_VISEVMOVAPARAMS = "VISeVmOvaParams";
public static final String FINDER_VRO_VISETMGMTIPSEREQ = "VISetMgmtIpSEReq";
public static final String FINDER_VRO_VISETVNICNWREQ = "VISetvNicNwReq";
public static final String FINDER_VRO_VIVMVNICINFO = "VIVmVnicInfo";
public static final String FINDER_VRO_VSDATASCRIPT = "VSDataScript";
public static final String FINDER_VRO_VSDATASCRIPTSET = "VSDataScriptSet";
public static final String FINDER_VRO_VSDATASCRIPTS = "VSDataScripts";
public static final String FINDER_VRO_VCENTERCLOUDSTATUSREQ = "VcenterCloudStatusReq";
public static final String FINDER_VRO_VCENTERCLUSTERDETAILS = "VcenterClusterDetails";
public static final String FINDER_VRO_VCENTERCLUSTERS = "VcenterClusters";
public static final String FINDER_VRO_VCENTERDATASTORE = "VcenterDatastore";
public static final String FINDER_VRO_VCENTERHOSTS = "VcenterHosts";
public static final String FINDER_VRO_VCENTERINVENTORYDIAGREQ = "VcenterInventoryDiagReq";
public static final String FINDER_VRO_VCENTERLOGIN = "VcenterLogin";
public static final String FINDER_VRO_VCENTERIMAGEDETAILS = "VcenterImageDetails";
public static final String FINDER_VRO_VCENTERQUARANTINEDHOSTPARAMS = "VcenterQuarantinedHostParams";
public static final String FINDER_VRO_VERSIONINFO = "VersionInfo";
public static final String FINDER_VRO_VINFRACNTLRHOSTUNREACHABLELIST = "VinfraCntlrHostUnreachableList";
public static final String FINDER_VRO_VINFRADISCSUMMARYDETAILS = "VinfraDiscSummaryDetails";
Expand Down Expand Up @@ -1135,11 +1124,12 @@ public class Constants {
public static final String FINDER_VRO_WAFRULEOVERRIDES = "WafRuleOverrides";
public static final String FINDER_VRO_WAFWHITELISTLOG = "WafWhitelistLog";
public static final String FINDER_VRO_WEBAPPLICATIONSIGNATURESERVICESTATUS = "WebApplicationSignatureServiceStatus";
public static final String FINDER_VRO_WEBAPPUT = "WebappUT";
public static final String FINDER_VRO_WEBHOOK = "Webhook";
public static final String FINDER_VRO_POSTSNAPSHOT = "postsnapshot";
public static final String FINDER_VRO_PRESNAPSHOT = "presnapshot";
public static final String FINDER_VRO_VCENTERCONFIGURATION = "vCenterConfiguration";
public static final String FINDER_VRO_VCLOUDAIRCONFIGURATION = "vCloudAirConfiguration";
public static final String FINDER_VRO_VNIC = "vNIC";
public static final String FINDER_VRO_VNICNETWORK = "vNICNetwork";
}
}
161 changes: 103 additions & 58 deletions o11nplugin-vro-core/src/main/java/com/vmware/avi/vro/VroPlugin.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
package com.vmware.avi.vro;

import java.util.Map;
import java.io.IOException;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

import com.vmware.avi.sdk.AviApi;
import com.vmware.avi.sdk.AviApiException;
import com.vmware.avi.sdk.AviCredentials;
import com.vmware.avi.vro.configuration.ConfigurationService;
import com.vmware.avi.vro.model.AviConnectionInfo;
import com.vmware.o11n.plugin.sdk.annotation.VsoFinder;
import com.vmware.o11n.plugin.sdk.annotation.VsoMethod;
import com.vmware.o11n.plugin.sdk.annotation.VsoObject;
import com.vmware.o11n.plugin.sdk.spring.AbstractSpringPluginFactory;
import com.vmware.o11n.plugin.sdk.spring.platform.GlobalPluginNotificationHandler;

import ch.dunes.vso.sdk.api.IPluginFactory;

@VsoObject(singleton = true, create = false)
@VsoFinder(name = Constants.FINDER_VRO_PLUGIN)
@VsoObject(singleton = true, name = "VroPlugin")
@VsoFinder(name = "VroPlugin")
@Scope(value = "prototype")
public class VroPlugin {
public static final String TYPE = "Vro";

@Autowired
private AviVroClient service;
private static final Logger log = LoggerFactory.getLogger(VroPlugin.class);

public static VroPlugin createScriptingSingleton(IPluginFactory factory) {
return ((AbstractSpringPluginFactory) factory).createScriptingObject(VroPlugin.class);
}

@Autowired
private ConfigurationService configurationService;

@Autowired
private GlobalPluginNotificationHandler notificationHandler;

/***
* Method will create AVI API session.
*
* Method will create AVI endpoints
*
* @param controller controller IP.
* @param username username of the controller
* @param password password of the controller
Expand All @@ -40,71 +49,107 @@ public static VroPlugin createScriptingSingleton(IPluginFactory factory) {
* @throws Exception
*/
@VsoMethod
public void addVroClient(String controller, String username, String password, String tenant, String version,
public String addVroClient(String controller, String username, String password, String tenant, String version,
String token) throws Exception {
String ctl = null;
try {
log.debug("__INIT__:: Inside addVroClient ");
AviConnectionInfo aviConnectionInfo = new AviConnectionInfo();
aviConnectionInfo.setController(controller);
aviConnectionInfo.setUsername(username);
aviConnectionInfo.setPassword(password);
aviConnectionInfo.setTenant(tenant);
aviConnectionInfo.setVersion(version);
aviConnectionInfo.setToken(token);
String addedController = controller + "-" + tenant;
aviConnectionInfo.setId(addedController);

ctl = this.saveAviConnectionEndpoint(addedController, aviConnectionInfo);
log.debug("__DONE__:: Inside addVroClient ");
} catch (Exception e) {
log.error("__ERROR__:: Inside addVroClient Catch: " + e.getMessage());
throw new Exception(e);
}
return ctl;
}

/**
* Method to store the all AVI endpoint
*
* @throws Exception
* @throws IOException
*/
public String saveAviConnectionEndpoint(String id, AviConnectionInfo aviConnectionInfo) throws Exception {
AviConnectionInfo info = null;
log.debug("__INIT__:: Inside storeAviConnections to store new connection by id: " + id);
try {
AviCredentials aviCredentials = new AviCredentials();
aviCredentials.setController(controller);
aviCredentials.setUsername(username);
aviCredentials.setPassword(password);
aviCredentials.setToken(token);
aviCredentials.setTenant(tenant);
aviCredentials.setVersion(version);
AviVroClient aviVroClient = new AviVroClient();
aviVroClient.setCred(aviCredentials);
aviVroClient.get("tenant", null, tenant);
String addedController = controller +"-"+ tenant;
if (!VroPluginFactory.aviVroClientMap.containsKey(addedController)) {
VroPluginFactory.aviVroClientMap.put(controller+ "-" + tenant, aviVroClient);
info = this.getVroClientById(id);
if (info != null) {
throw new Exception("Controller with the same IP is already exists: "+ id);
}else {
throw new AviApiException("Controller with this tenant is already Exists.");
log.debug("__DEBUG__:: Adding new Avi connection to the endpoint. ");
info = configurationService.save(aviConnectionInfo);
notificationHandler.notifyElementsInvalidate();
}
}catch (Exception e) {
throw new AviApiException(e.getMessage());
} catch (Exception e) {
log.error("__ERROR__:: Inside storeAviConnections Catch: ");
throw new Exception(e.getMessage());
}
log.debug("__DONE__:: Added new Avi connection to the endpoint. ");
return info.getController();
}

/****
* This method add controller into the Plugin.
*
* @param controller controller IP.
* @param username username of the controller
* @param password password of the controller
* @param tenant tenant name
* @param version version
/**
* Method get all added AVI vro clients
*
* @return
* @throws Exception
*/
@VsoMethod
@Deprecated
public void addVroClient(String controller, String username, String password, String tenant, String version) throws Exception {
public List<AviConnectionInfo> getAllAviClients() throws Exception {
try {
AviCredentials aviCredentials = new AviCredentials(controller, username, password);
aviCredentials.setTenant(tenant);
aviCredentials.setVersion(version);
AviVroClient aviVroClient = new AviVroClient();
aviVroClient.setCred(aviCredentials);
aviVroClient.get("tenant", null, tenant);
String addedController = controller +"-"+ tenant;
if (!VroPluginFactory.aviVroClientMap.containsKey(addedController)) {
VroPluginFactory.aviVroClientMap.put(controller+ "-" + tenant, aviVroClient);
}else {
throw new AviApiException("Controller with this tenant is already Exists.");
}
}catch (Exception e) {
return configurationService.getAll();
} catch (Exception e) {
throw new AviApiException(e.getMessage());
}
}

/**
* This method remove controller from the Plugin
*
* @param controller controller IP.
* Method get added AVI vro clients by id
*
* @return
* @throws Exception
*/
private AviConnectionInfo getVroClientById(String id) throws Exception {
try {
return configurationService.findById(id);
} catch (Exception e) {
throw new AviApiException(e.getMessage());
}
}

@VsoMethod(description = "Loads the configuration of all brokers.")
public void loadConfiguration() {
configurationService.load();
notificationHandler.notifyElementsInvalidate();
}

/**
* Method remove added AVI vro clients
*
* @return
* @throws Exception
*/
@VsoMethod
public void removeVroClient(String controller) {
Map<String, AviVroClient> aviVroClientsMap = VroPluginFactory.getListOfAviVroClientMap();
if (aviVroClientsMap.containsKey(controller)) {
aviVroClientsMap.remove(controller);
public void removeVroClient(String controller) throws Exception {
log.debug("__INIT__:: Inside removeAviClient to remove connection by id: " + controller);
try {
AviConnectionInfo info = configurationService.findById(controller);
log.debug("__DEBUG__:: Fetch avi connection from added endpoints: " + info);
configurationService.delete(info);
log.debug("__DONE__:: Succefully removed Avi connection from the endpoint.");
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
}
Loading

0 comments on commit cffbb1e

Please sign in to comment.