nvazquez commented on a change in pull request #3732: [Vmware] Enable PVLAN
support on L2 networks
URL: https://github.com/apache/cloudstack/pull/3732#discussion_r358226332
##########
File path: api/src/main/java/com/cloud/network/Network.java
##########
@@ -44,6 +46,24 @@
Shared, Isolated, L2
}
+ enum PVlanType {
+ Community, Isolated, Promiscuous;
+
+ static PVlanType fromValue(String type) {
+ if (StringUtils.isBlank(type)) {
+ return null;
+ } else if (type.equalsIgnoreCase("promiscuous") ||
type.equalsIgnoreCase("p")) {
+ return Promiscuous;
+ } else if (type.equalsIgnoreCase("community") ||
type.equalsIgnoreCase("c")) {
+ return Community;
+ } else if (type.equalsIgnoreCase("isolated") ||
type.equalsIgnoreCase("i")) {
+ return Isolated;
+ } else {
+ throw new InvalidParameterValueException("Unexpected Private
VLAN type: " + type);
Review comment:
What about `type.length() == 1 && type.equalsIgnoreCase("i")` for the single
letter case? Otherwise we are allowing substrings and we would like either the
first letter or the whole type
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services