|
16 | 16 | // under the License. |
17 | 17 | package com.cloud.network.element; |
18 | 18 |
|
| 19 | +import java.net.URISyntaxException; |
19 | 20 | import java.util.ArrayList; |
20 | 21 | import java.util.Collections; |
21 | 22 | import java.util.HashMap; |
@@ -247,13 +248,18 @@ public boolean implement(Network network, NetworkOffering offering, DeployDestin |
247 | 248 | String internalCidr = network.getGateway() + "/" + network.getCidr().split("/")[1]; |
248 | 249 | // assuming a vlan: |
249 | 250 | String vtag = sourceNatIp.getVlanTag(); |
250 | | - BroadcastDomainType tiep = BroadcastDomainType.toEnumValue(vtag); |
| 251 | + BroadcastDomainType tiep = null; |
| 252 | + try { |
| 253 | + tiep = BroadcastDomainType.getTypeOf(vtag); |
| 254 | + } catch (URISyntaxException use) { |
| 255 | + throw new CloudRuntimeException("vlantag for sourceNatIp is not valid: " + vtag, use); |
| 256 | + } |
251 | 257 | if (tiep == BroadcastDomainType.Vlan) { |
252 | 258 | vtag = BroadcastDomainType.Vlan.getValueFrom(BroadcastDomainType.fromString(vtag)); |
253 | | - } else if (tiep != BroadcastDomainType.UnDecided) { |
| 259 | + } else if (!(tiep == BroadcastDomainType.UnDecided || tiep == BroadcastDomainType.Native)) { |
254 | 260 | throw new CloudRuntimeException("only vlans are supported for sourceNatIp, at this moment: " + vtag); |
255 | 261 | } |
256 | | - long vlanid = (Vlan.UNTAGGED.equals(sourceNatIp.getVlanTag())) ? 0 : Long.parseLong(vtag); |
| 262 | + long vlanid = (Vlan.UNTAGGED.equals(vtag)) ? 0 : Long.parseLong(vtag); |
257 | 263 |
|
258 | 264 | CreateLogicalRouterCommand cmd = |
259 | 265 | new CreateLogicalRouterCommand(niciraNvpHost.getDetail("l3gatewayserviceuuid"), vlanid, BroadcastDomainType.getValue(network.getBroadcastUri()), |
|
0 commit comments