Examples of FirewallRule


Examples of com.cloud.network.rules.FirewallRule

    }

    @Override
    public long getEntityOwnerId() {
        if (ownerId == null) {
            FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
            if (rule == null) {
                throw new InvalidParameterValueException("Unable to find firewall rule by id=" + id);
            } else {
                ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
            }
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

    @Override
    public void execute() throws ResourceUnavailableException {
        UserContext callerContext = UserContext.current();
        boolean success = false;
        FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
        try {
            UserContext.current().setEventDetails("Rule Id: " + getEntityId());
             success = _firewallService.applyEgressFirewallRules (rule, callerContext.getCaller());
            // State is different after the rule is applied, so get new object here
            rule = _entityMgr.findById(FirewallRule.class, getEntityId());
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

                throw new  InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
                        " as firewall egress rule can be created only for non vpc networks.")
            }

        try {
            FirewallRule result = _firewallService.createEgressFirewallRule(this);
            setEntityId(result.getId());
        } catch (NetworkRuleConflictException ex) {
            s_logger.info("Network rule conflict: " + ex.getMessage());
            s_logger.trace("Network Rule Conflict: ", ex);
            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
        }
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

    @Override
    public void execute() throws ResourceUnavailableException {
        UserContext callerContext = UserContext.current();
        boolean success = false;
        FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
        try {
            UserContext.current().setEventDetails("Rule Id: " + getEntityId());
            success = _firewallService.applyIngressFirewallRules(rule.getSourceIpAddressId(), callerContext.getCaller());

            // State is different after the rule is applied, so get new object here
            rule = _entityMgr.findById(FirewallRule.class, getEntityId());
            FirewallResponse fwResponse = new FirewallResponse();
            if (rule != null) {
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

                }
            }
        }

        try {
            FirewallRule result = _firewallService.createIngressFirewallRule(this);
            setEntityId(result.getId());
            setEntityUuid(result.getUuid());
        } catch (NetworkRuleConflictException ex) {
            s_logger.info("Network rule conflict: " + ex.getMessage());
            s_logger.trace("Network Rule Conflict: ", ex);
            throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
        }
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

    }

    @Override
    public long getEntityOwnerId() {
        if (ownerId == null) {
            FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
            if (rule == null) {
                throw new InvalidParameterValueException("Unable to find egress firewall rule by id");
            } else {
                ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
            }
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

        return success && rules.size() == 0;
    }

    @Override
    public boolean revokeRelatedFirewallRule(long ruleId, boolean apply) {
        FirewallRule fwRule = _firewallDao.findByRelatedId(ruleId);

        if (fwRule == null) {
            s_logger.trace("No related firewall rule exists for rule id=" + ruleId + " so returning true here");
            return true;
        }

        s_logger.debug("Revoking Firewall rule id=" + fwRule.getId() + " as a part of rule delete id=" + ruleId + " with apply=" + apply);
        return revokeFirewallRule(fwRule.getId(), apply);

    }
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

        HostVO hostVO = mock(HostVO.class);
        when(hostVO.getId()).thenReturn(1L);
        when(_hostDao.findById(anyLong())).thenReturn(hostVO);

        FirewallRule rule = mock(FirewallRule.class);
        when(rule.getSourceIpAddressId()).thenReturn(1L);
        List<FirewallRule> rules = new ArrayList<FirewallRule>();
        rules.add(rule);

        Answer answer = mock(Answer.class);
        when(answer.getResult()).thenReturn(true);
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

    @Override
    public void execute() throws ResourceUnavailableException{

        boolean result = true;
        FirewallRule rule = null;
        try {
            UserContext.current().setEventDetails("Rule Id: "+ getEntityId());

            if (getOpenFirewall()) {
                result = result && _firewallService.applyIngressFirewallRules(ipAddressId, UserContext.current().getCaller());
View Full Code Here

Examples of com.cloud.network.rules.FirewallRule

    }

    @Override
    public long getEntityOwnerId() {
        if (ownerId == null) {
            FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
            if (rule == null) {
                throw new InvalidParameterValueException("Unable to find static nat rule by id: " + id);
            } else {
                ownerId = rule.getAccountId();
            }
        }
        return ownerId;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.