/** * @see RouterDeploymentDefinition#prepareDeployment() * * @return if the deployment can proceed */ @Override protected boolean prepareDeployment() { //Check if the VR is the src NAT provider... isPublicNetwork = vpcMgr.isSrcNatIpRequired(vpc.getVpcOfferingId()); // Check if public network has to be set on VR return true; }
@Override public void loadCidrs(NetworkACLItemVO item) { List<String> cidrs = _networkACLItemCidrsDao.getCidrs(item.getId()); item.setSourceCidrList(cidrs); }
public StaticRouteProfile(StaticRoute staticRoute, VpcGateway gateway) { id = staticRoute.getId(); uuid = staticRoute.getUuid(); targetCidr = staticRoute.getCidr(); accountId = staticRoute.getAccountId(); domainId = staticRoute.getDomainId(); gatewayId = staticRoute.getVpcGatewayId(); state = staticRoute.getState(); vpcId = staticRoute.getVpcId(); vlanTag = gateway.getBroadcastUri(); this.gateway = gateway.getGateway(); netmask = gateway.getNetmask(); ipAddress = gateway.getIp4Address(); }
@Override public boolean applyACLToPrivateGw(final PrivateGateway gateway) throws ResourceUnavailableException { final VpcGatewayVO vpcGatewayVO = _vpcGatewayDao.findById(gateway.getId()); final List<? extends NetworkACLItem> rules = _networkACLItemDao.listByACL(vpcGatewayVO.getNetworkACLId()); return applyACLToPrivateGw(gateway, rules); }
@Override public void create() { NetworkACLItem result = _networkACLService.createNetworkACLItem(this); setEntityId(result.getId()); setEntityUuid(result.getUuid()); }
/** * Moves a network ACL rule to the bottom of the list. This is executed by getting the 'number' field of the last ACL rule from the ACL list, and incrementing one. * This new value is assigned to the network ACL being moved and updated in the database using {@link NetworkACLItemDao#updateNumberFieldNetworkItem(long, int)}. */ protected NetworkACLItem moveRuleToTheBottom(NetworkACLItemVO ruleBeingMoved, List<NetworkACLItemVO> allAclRules) { NetworkACLItemVO lastAclRule = allAclRules.get(allAclRules.size() - 1); int newNumberFieldValue = lastAclRule.getNumber() + 1; ruleBeingMoved.setNumber(newNumberFieldValue); _networkACLItemDao.updateNumberFieldNetworkItem(ruleBeingMoved.getId(), newNumberFieldValue); return _networkACLItemDao.findById(ruleBeingMoved.getId()); }
@Override public boolean update(Long id, NetworkACLItemVO item) { boolean result = super.update(id, item); _networkACLItemCidrsDao.updateCidrs(item.getId(), item.getSourceCidrList()); return result; }
@Override public boolean revokeNetworkACLItem(final long ruleId) { final NetworkACLItemVO rule = _networkACLItemDao.findById(ruleId); revokeRule(rule); boolean success = false; try { applyNetworkACL(rule.getAclId()); success = true; } catch (final ResourceUnavailableException e) { return false; } return success; }
@Override public void create() { NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), isDisplay()); setEntityId(result.getId()); setEntityUuid(result.getUuid()); }
@Override public Long getSyncObjId() { StaticRoute route = _vpcService.getStaticRoute(id); if (route == null) { throw new InvalidParameterValueException("Invalid id is specified for the static route"); } return route.getVpcId(); }
/** * Performs all of the validations for the {@link NetworkACLItem}. * First we validate the sources start and end ports using {@link #validateSourceStartAndEndPorts(NetworkACLItemVO)}; * then, we validate the source CIDR list using {@link #validateSourceCidrList(NetworkACLItemVO)}; * afterwards, it is validated the protocol entered in the {@link NetworkACLItemVO} using {@link #validateProtocol(NetworkACLItemVO)}. */ protected void validateNetworkACLItem(NetworkACLItemVO networkACLItemVO) { validateSourceStartAndEndPorts(networkACLItemVO); validateSourceCidrList(networkACLItemVO); validateProtocol(networkACLItemVO); }
@Override public PrivateGateway getVpcPrivateGateway(final long id) { final VpcGateway gateway = _vpcGatewayDao.findById(id); if (gateway == null || gateway.getType() != VpcGateway.Type.Private) { return null; } return getPrivateGatewayProfile(gateway); }
@Override protected void findSourceNatIP() throws InsufficientAddressCapacityException, ConcurrentOperationException { sourceNatIp = null; if (isPublicNetwork) { sourceNatIp = vpcMgr.assignSourceNatIpAddressToVpc(owner, vpc); } }
@Override public String getGateway() { return vpcGateway.getGateway(); }
@Override public boolean isRollingRestart() { return vpc.isRollingRestart(); } }
/** * Move the rule to the top of the ACL rule list. This means that the ACL rule being moved will receive the position '1'. * Also, if necessary other ACL rules will have their 'number' field updated to create room for the new top rule. */ protected NetworkACLItem moveRuleToTheTop(NetworkACLItemVO ruleBeingMoved, List<NetworkACLItemVO> allAclRules) { return updateAclRuleToNewPositionAndExecuteShiftIfNecessary(ruleBeingMoved, 1, allAclRules, 0); }
@Override public void doInTransactionWithoutResult(final TransactionStatus status) { for (final StaticRouteVO route : routes) { markStaticRouteForRevoke(route, caller); } } });
@Override public String getUuid() { return vpcGateway.getUuid(); }