Fix IndexOutOfBoundsException when creating basic network (#4464)

For Basic network isolation methods are not provided, and exception is
thrown when trying to encode the Vlan id. That's why we have to check
before encoding that the list with isolation methods is not empty
This commit is contained in:
slavkap 2020-11-13 10:07:40 +02:00 committed by GitHub
parent 8afb451c1c
commit cc8bee7223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2484,7 +2484,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
throw new InvalidParameterValueException(String.format("Failed to encode VLAN/VXLAN %s into a Broadcast URI. Physical Network cannot be null.", vlanId));
}
if(StringUtils.isNotBlank(pNtwk.getIsolationMethods().get(0))) {
if(!pNtwk.getIsolationMethods().isEmpty() && StringUtils.isNotBlank(pNtwk.getIsolationMethods().get(0))) {
String isolationMethod = pNtwk.getIsolationMethods().get(0).toLowerCase();
String vxlan = BroadcastDomainType.Vxlan.toString().toLowerCase();
if(isolationMethod.equals(vxlan)) {