Skip to content

Commit

Permalink
Av 84252 : Model based VRO with all Avi Objects (#40)
Browse files Browse the repository at this point in the history
* Overloaded methods modified and unwanted workflow removed

* Code added for proper exception handling

* All models added and workflow names changes

* Code changes made to iterate Model Map & Test cases fixes
  • Loading branch information
tusharlimbhore authored May 13, 2020
1 parent d505b02 commit c069704
Show file tree
Hide file tree
Showing 741 changed files with 196,446 additions and 5,181 deletions.
289 changes: 164 additions & 125 deletions o11nplugin-vro-core/src/main/java/com/vmware/avi/vro/AviVroClient.java

Large diffs are not rendered by default.

757 changes: 686 additions & 71 deletions o11nplugin-vro-core/src/main/java/com/vmware/avi/vro/Constants.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public static VroPlugin createScriptingSingleton(IPluginFactory factory) {
return ((AbstractSpringPluginFactory) factory).createScriptingObject(VroPlugin.class);
}

/***
* Method will create AVI API session.
*
* @param controller controller IP.
* @param username username of the controller
* @param password password of the controller
* @param tenant tenant name
* @param version version
* @return instance of AviVroClient
*/
@VsoMethod
public AviVroClient connect(String controller, String username, String password, String tenant, String version) {
AviCredentials creds = new AviCredentials(controller, username, password);
Expand All @@ -32,6 +42,16 @@ public AviVroClient connect(String controller, String username, String password,
service.setCred(creds);
return service;
}

/****
* 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
*/
@VsoMethod
public void addVroClient(String controller, String username, String password, String tenant, String version) {

Expand All @@ -40,12 +60,14 @@ public void addVroClient(String controller, String username, String password, St
aviCredentials.setVersion(version);
AviVroClient aviVroClient = new AviVroClient();
aviVroClient.setCred(aviCredentials);
// List<AviVroClient> listOfAviVroClients = VroPluginFactory.listOfAviVroClient;
// VroPluginFactory.listOfAviVroClient.add(aviVroClient);

VroPluginFactory.aviVroClientMap.put(controller, aviVroClient);
}

/**
* This method remove controller from the Plugin
*
* @param controller controller IP.
*/
@VsoMethod
public void removeVroClient(String controller) {
Map<String, AviVroClient> aviVroClientsMap = VroPluginFactory.getListOfAviVroClientMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,18 @@
*
*/
public final class VroPluginAdaptor extends AbstractSpringPluginAdaptor {

private static final String DEFAULT_CONFIG = "com/vmware/avi/vro/pluginConfig.xml";

static final String ROOT = "Endpoint";
static final String REL_ROOTS = "roots";

@Override
protected ApplicationContext createApplicationContext(ApplicationContext defaultParent) {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
new String[] { DEFAULT_CONFIG }, false, defaultParent);
applicationContext.setClassLoader(getClass().getClassLoader());
applicationContext.refresh();
try {
VroPluginFactory.initializeModelMap();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}

return applicationContext;
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package com.vmware.avi.vro.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.vmware.avi.vro.model.ALBServicesAccountUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
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.avi.vro.Constants;
import org.springframework.stereotype.Service;
/**
* ALBServicesAccount
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-05-07T17:09:16.137+05:30")

@VsoObject(create = false, name = "ALBServicesAccount")
@VsoFinder(name = Constants.FINDER_VRO_ALBSERVICESACCOUNT, idAccessor = "getObjectID()")
@Service
public class ALBServicesAccount extends AviRestResource {
@JsonProperty("id")
private String id = null;

@JsonProperty("name")
private String name = null;

@JsonProperty("users")
@Valid
private List<ALBServicesAccountUser> users = null;


/**
* ID of an Account in the customer portal. Field introduced in 20.1.1.
* @return id
**/
@ApiModelProperty(value = "ID of an Account in the customer portal. Field introduced in 20.1.1.")



@VsoMethod
public String getId() {
return id;
}

@VsoMethod
public void setId(String id) {
this.id = id;
}


/**
* Account to which the customer portal user belongs. Field introduced in 20.1.1.
* @return name
**/
@ApiModelProperty(value = "Account to which the customer portal user belongs. Field introduced in 20.1.1.")



@VsoMethod
public String getName() {
return name;
}

@VsoMethod
public void setName(String name) {
this.name = name;
}


public ALBServicesAccount addUsersItem(ALBServicesAccountUser usersItem) {
if (this.users == null) {
this.users = new ArrayList<ALBServicesAccountUser>();
}
this.users.add(usersItem);
return this;
}

/**
* Information about users within the account in the customer portal. Field introduced in 20.1.1.
* @return users
**/
@ApiModelProperty(value = "Information about users within the account in the customer portal. Field introduced in 20.1.1.")

@Valid


@VsoMethod
public List<ALBServicesAccountUser> getUsers() {
return users;
}

@VsoMethod
public void setUsers(List<ALBServicesAccountUser> users) {
this.users = users;
}


public String getObjectID() {
return "ALBServicesAccount";
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ALBServicesAccount alBServicesAccount = (ALBServicesAccount) o;
return Objects.equals(this.id, alBServicesAccount.id) &&
Objects.equals(this.name, alBServicesAccount.name) &&
Objects.equals(this.users, alBServicesAccount.users);
}

@Override
public int hashCode() {
return Objects.hash(id, name, users);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ALBServicesAccount {\n");

sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" users: ").append(toIndentedString(users)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package com.vmware.avi.vro.model;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
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.avi.vro.Constants;
import org.springframework.stereotype.Service;
/**
* ALBServicesAccountUser
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-05-07T17:09:16.137+05:30")

@VsoObject(create = false, name = "ALBServicesAccountUser")
@VsoFinder(name = Constants.FINDER_VRO_ALBSERVICESACCOUNTUSER, idAccessor = "getObjectID()")
@Service
public class ALBServicesAccountUser extends AviRestResource {
@JsonProperty("email")
private String email = null;

@JsonProperty("name")
private String name = null;

@JsonProperty("phone")
private String phone = null;


/**
* Field introduced in 20.1.1.
* @return email
**/
@ApiModelProperty(required = true, value = " Field introduced in 20.1.1.")
@NotNull



@VsoMethod
public String getEmail() {
return email;
}

@VsoMethod
public void setEmail(String email) {
this.email = email;
}


/**
* Field introduced in 20.1.1.
* @return name
**/
@ApiModelProperty(required = true, value = " Field introduced in 20.1.1.")
@NotNull



@VsoMethod
public String getName() {
return name;
}

@VsoMethod
public void setName(String name) {
this.name = name;
}


/**
* Field introduced in 20.1.1.
* @return phone
**/
@ApiModelProperty(required = true, value = " Field introduced in 20.1.1.")
@NotNull



@VsoMethod
public String getPhone() {
return phone;
}

@VsoMethod
public void setPhone(String phone) {
this.phone = phone;
}


public String getObjectID() {
return "ALBServicesAccountUser";
}

@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ALBServicesAccountUser alBServicesAccountUser = (ALBServicesAccountUser) o;
return Objects.equals(this.email, alBServicesAccountUser.email) &&
Objects.equals(this.name, alBServicesAccountUser.name) &&
Objects.equals(this.phone, alBServicesAccountUser.phone);
}

@Override
public int hashCode() {
return Objects.hash(email, name, phone);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ALBServicesAccountUser {\n");

sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Loading

0 comments on commit c069704

Please sign in to comment.