type inet:ip-address;
}
leaf protocol {
- type enumeration {
- enum null {
- description "NULL protocol.";
- }
- enum icmp {
- description "ICMP protocol.";
- }
- enum udp {
- description "UDP protocol.";
- }
- enum tcp {
- description "TCP protocol.";
+ type union {
+ type uint8;
+ type enumeration {
+ enum null {
+ description "NULL protocol.";
+ }
+ enum icmp {
+ description "ICMP protocol.";
+ }
+ enum udp {
+ description "UDP protocol.";
+ }
+ enum tcp {
+ description "TCP protocol.";
+ }
}
}
description "The protocol that is matched by the security group rule.";
}
}
leaf port-range-min {
- type uint32;
+ type uint16;
description "The minimum port number in the range that is matched by the
security group rule. If the protocol is TCP or UDP, this value must
be less than or equal to the value of the attribute. If the protocol
is ICMP, this value must be an ICMP type.";
}
leaf port-range-max {
- type uint32;
+ type uint16;
description "The maximum port number in the range that is matched by the
security group rule. If the protocol is TCP or UDP, this value must
be less than or equal to the value of the attribute. If the protocol
}
if (securityRule.getSecurityRuleProtocol() != null) {
boolean foundMatch = false;
- for (SecurityRuleAttrs.Protocol protocol : SecurityRuleAttrs.Protocol.values()) {
+ for (SecurityRuleAttrs.Protocol.Enumeration protocol : SecurityRuleAttrs.Protocol.Enumeration.values()) {
if (protocol.toString().equalsIgnoreCase(securityRule.getSecurityRuleProtocol())) {
- securityRuleBuilder.setProtocol(protocol);
+ securityRuleBuilder.setProtocol(new SecurityRuleAttrs.Protocol(protocol));
foundMatch = true;
break;
}
}
if (!foundMatch) {
- LOGGER.warn("Unable to find protocol value for {}", securityRule.getSecurityRuleProtocol());
+ try {
+ java.lang.Short protocol = Short.valueOf(securityRule.getSecurityRuleProtocol());
+ securityRuleBuilder.setProtocol(new SecurityRuleAttrs.Protocol(protocol));
+ } catch (NumberFormatException e) {
+ LOGGER.warn("Unable to find protocol value for {}", securityRule.getSecurityRuleProtocol());
+ }
}
}
if (securityRule.getSecurityRuleEthertype() != null) {
}
}
if (securityRule.getSecurityRulePortMin() != null) {
- securityRuleBuilder.setPortRangeMin(new Long(securityRule.getSecurityRulePortMin()));
+ securityRuleBuilder.setPortRangeMin(new Integer(securityRule.getSecurityRulePortMin()));
}
if (securityRule.getSecurityRulePortMax() != null) {
- securityRuleBuilder.setPortRangeMax(new Long(securityRule.getSecurityRulePortMax()));
+ securityRuleBuilder.setPortRangeMax(new Integer(securityRule.getSecurityRulePortMax()));
}
if (securityRule.getSecurityRuleUUID() != null) {
securityRuleBuilder.setId(toUuid(securityRule.getSecurityRuleUUID()));